I'm getting the HttpHeaders from context as below:

@Context
private HttpHeaders httpHeaders;

Now I try to identify the mediaType in the handleMessage(....) method in the
RestFilter as below:

MediaType mediaType = httpHeaders.getMediaType();
                log.info("MediaType : "+mediaType);  // This prints /MediaType :
application/xml;charset=UTF-8/
                log.info("MediaType : "+mediaType.getType()); // This prints 
/MediaType :
application/
                if(mediaType.equals("application/xml")){
                        log.info("xml processing");
                        response = handleJaxbRequest(message);
                } else if (mediaType.equals("application/json")){
                        log.info("json processing");
                        response = handleJsonRequest(message);
                } else {
                        log.info("neither xml nor json, so bad request");
                        return Response.status(Status.BAD_REQUEST).build();
                }

Even I tried giving the string "application/xml;charset=UTF-8" to the equals
method, perhaps the control still ends in the last else block.

Any idea



--
View this message in context: 
http://cxf.547215.n5.nabble.com/MediaType-equals-Object-obj-method-issue-tp5720558.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to