Hello:
I'm using CXF 2.7.8 + JAX-RS to deploy a REST webservice
I've defined a RequestHandler to modify HTTP Content-Type header for
incoming request
But it doesnt work
MyRequestHandler class implements
@Override
public Response handleRequest(Message message, ClassResourceInfo info)
{
message.put(Message.CONTENT_TYPE, MediaType.APPLICATION_JSON);
message.put(Message.ACCEPT_CONTENT_TYPE, MediaType.APPLICATION_JSON);
logger.info("New Content-Type {}", message.get(Message.CONTENT_TYPE));
return null;
}
And I configure
<jaxrs:providers>
<ref bean="myRequestHandler"/>
<ref bean="jsonProvider"/>
</jaxrs:providers>
When the webservice receives a request with ContentType :
application/x-www-form-urlencoded,
logs show that Content-Type header wan't modified before selecting method
13:23:23.605 [http-bio-8080-exec-138] INFO [MyRequestHandler]
[handleRequest] - New Content-Type application/json
13:23:23.605 [http-bio-8080-exec-138] DEBUG [JAXRSUtils]
[findTargetMethod] - Trying to select a resource operation on the
resource class com.ws.MyService
13:23:23.606 [http-bio-8080-exec-138] DEBUG [JAXRSUtils]
[logNoMatchMessage] - No method match, method name : notify, request
path : /notify, method @Path : /notify, HTTP Method : POST, method
HTTP Method : POST, ContentType : application/x-www-form-urlencoded,
method @Consumes : application/json,, Accept : application/json,,
method @Produces : application/json,.
What is wrong ? Do I need to do it with an interceptor ? Any example '
Thanks and regards