cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Mazza <>
Subject Re: REST sample works with CXF 2.6.2 but not CXF 2.7.4...
Date Tue, 14 May 2013 14:29:36 GMT
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:
> 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.


View this message in context:
Sent from the cxf-user mailing list archive at

View raw message