Hi
Thanks for your query,

Have a look please at these two endpoint configurations:

1.
https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml#L123

In this case JSONProvider is updated to recognize a default JSONP type:

https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml#L264

2. https://github.com/apache/cxf/blob/master/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml#L146

In this case Jackson is used but JSONP interceptor is updated to with an accept property.

Looks like it is case 1 in your case: JSONP interceptors set the response Content-Type to a JSONP media type but this is done before JAX-RS tries to write a body and thus JSONProvider can not accept it as it does not support JSONP out of the box.

I don't remember right now why the configuration with Jackson is different, may be because it has a wildcard Produces.

HTH, Sergey
On 18/07/16 17:37, CLEMENT Jean-Philippe wrote:
Dear CXF users,

I'm new to CXF and I'm writing a kind of "hello world" JAX-RS service which 
works well with the default JSON output. Following the user doc, I added interceptors to 
allow JSONP output.

JSONP messages now contain the callback method name but its message content is "No 
message body writer has been found for class...". This is strange as if I remove the 
interceptors, the JSON output is correct (the message content is serialized properly).

I tried to set the provider to 
"org.apache.cxf.jaxrs.provider.json.JSONProvider" but with no success (same 
output). What's wrong?

Regards,
Jean-Philippe


Reply via email to