Glen Mazza wrote
>>
>> Ok, I've looked into it closer. The reason it did not work with CXF 
>> 2.7.6 was that Jackson provider is not typed to support 
>> application/x+javascript. Setting "application/json" on JSONP in 
>> interceptor is needed to get the runtime successfully selecting the 
>> Jackson provider, however in CXF 2.7.6 the way the response type is 
>> handled has changed (in the better way), so what happened was that 
>> JSONP out pre-stream interceptor was actually setting
>>
>> "application/x+javascript" (so that a proper response type is 
>> returned), but it does it too early actually though that worked in CXF 
>> 2.6.7 as this type was not affecting the selection of MBW.
>>
>> Basically, if you update your example to set a mediaType property on 
>> the out stream interceptor as "application/json" the example will 
>> start working, but that will return "application/json" content type to 
>> the browser.
>>
>> I've just added JAX-RS 2.0 out filter which should be used from now 
>> on, it will set a response content type after Jackson has been 
>> selected but before it is actually invoked, in the end resulting in a 
>> proper content type returned too, so remove
>>
>> bean.getOutInterceptors().add(new JsonpPreStreamInterceptor());
>>
>> and add
>>
>> providerList.add(new 
>> org.apache.cxf.jaxrs.provider.jsonp.JsonpJaxrsWriterInterceptor());
>>
>> It is a long story :-), but it has become better. And IMHO is still 
>> cleaner than using JSONPadding objects within the application code
>>
>>
> 
> Hmm, I made the change:
> https://github.com/gmazza/jersey-samples-on-cxf/commit/811d97be876286bfe62f2bc2e13667a25a0e5bfd
> 
> But still isn't working:
> curl -HAccept:application/x+javascript 
> http://localhost:9998/jsonp/changes?_jsonp=myCallback
> No message body writer has been found for response class LinkedList.);

jsonp example working now with 2.7.6-SNAPSHOT -- I forgot to set the media
type as you detailed above.  We're done.

Thanks,
Glen




--
View this message in context: 
http://cxf.547215.n5.nabble.com/REST-sample-works-with-CXF-2-6-2-but-not-CXF-2-7-4-tp5727173p5727657.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to