I'm modifying an existing ExceptionMapper we have that had previously,
explicitly set @Produces to use a media type of APPLICATION_XML only and set
this media type on the returned Response.
I'd like to add JSON to the @Produces and remove the code blurb that
explicitly set the media type on the returned Response but want to ensure
that CXF will use the "correct" media type depending on the original
request. E.g., if the original request's Accepts header says JSON then the
mapper would return a JSON response:
@Override
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response toResponse(MyException myException) {
// *snip*
return Response.entity(...).build(); // no media type specified
}
Will this work as intended?
--
View this message in context:
http://cxf.547215.n5.nabble.com/Ensuring-correct-MediaType-on-ExceptionMapper-tp5732905.html
Sent from the cxf-user mailing list archive at Nabble.com.