Hi
As far as I recall it should work with JSONProvider pre-configured to
support application/x+javascript or similar which is not possible with
Jackson which is where a writer interceptor comes in where it
temporarily sets application/json for Jackson to write the data out
I'll double check a bit later
Sergey
On 01/07/14 09:30, Jack Huang wrote:
When I register JsonpPreStreamInterceptor into <jaxrs:outInterceptors>, the
JSONP is not works, as below configuration:
<jaxrs:server address="/rest">
<jaxrs:serviceBeans>
<ref bean="productServiceImpl"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean
class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
</jaxrs:providers>
<jaxrs:inInterceptors>
<bean
class="org.apache.cxf.jaxrs.provider.jsonp.JsonpInInterceptor"/>
</jaxrs:inInterceptors>
<jaxrs:outInterceptors>
*<bean
class="org.apache.cxf.jaxrs.provider.jsonp.JsonpPreStreamInterceptor"/>*
<bean
class="org.apache.cxf.jaxrs.provider.jsonp.JsonpPostStreamInterceptor"/>
</jaxrs:outInterceptors>
</jaxrs:server>
But, when I put JsonpPreStreamInterceptor into <jaxrs:providers>, the JSONP
is OK, as below configuration:
<jaxrs:server address="/rest">
<jaxrs:serviceBeans>
<ref bean="productServiceImpl"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean
class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
*<bean
class="org.apache.cxf.jaxrs.provider.jsonp.JsonpPreStreamInterceptor"/>*
</jaxrs:providers>
<jaxrs:inInterceptors>
<bean
class="org.apache.cxf.jaxrs.provider.jsonp.JsonpInInterceptor"/>
</jaxrs:inInterceptors>
<jaxrs:outInterceptors>
<bean
class="org.apache.cxf.jaxrs.provider.jsonp.JsonpPostStreamInterceptor"/>
</jaxrs:outInterceptors>
</jaxrs:server>
I have not configured the mediaType property to "application/json" in
JsonpPreStreamInterceptor.
CXF Version is 3.0.0
--
View this message in context:
http://cxf.547215.n5.nabble.com/JSONP-is-not-works-tp5739858p5745795.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com