Hi

as far as I recall, Jackson provider checks in its isReadable if MediaType is application/json.


Have a Pre-Match container request filter which changes content type to application/json if it is a wildcard.

Cheers, Sergey
On 10/08/17 15:42, Vassilis Virvilis wrote:
Hi everybody,

I am using cxf-3.1.7 with jax-rs and JacksonJsonProvider

My application works normally but when BingPreview tries to crawl my page I get

ERROR 2017-08-10 12:32:51,561 ajp-nio-8009-exec-4: org.apache.cxf.jaxrs.utils.JAXRSUtils.logMessageHandlerProblem(JAXRSUtils.java:1811): No message body writer has been found for class com.lib.datatype.Config, ContentType: */*

BingPreview is a Microsoft bot that generates page preview and apparently can ran JavaScript. Here is the user_agent: Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 BingPreview/1.0b

Apparently BingPreview calls my method with Accept: */* instead of "application/json"

I can recreate the behavior with curl

curl -iH "application/json" http://... works as expected
curl -i http://... gives the same error

The question is the following: Since the client explicitly specified that accepts anything why CXF has a problem with that and throws an exception? It should return "application/json" and specify that to the ContentType not throw an exception? Right? Wrong? What do you think?

    Vassilis

Reply via email to