Hi,
Here is my situation.
1) The generation of appropriate format (XML/JSON etc) is custom and not
JAXB based so that i have my own convertor to convert objects to these
format.
2) So, according to the above case, i need to return String in all the GET
methods in my Servlet for handling the requests.
3) However i need to set the appropriate Content Type in the response so
that the browser can interpret it.
4) My GET methods are annotated with @Produces({MediaType.TEXT_XML,
MediaType.APPLICATION_JSON}) so that these are the applicable types which
can be returned.
5) Before returning the String in the method, i am setting the appropriate
Content Type in the response(I am injecting HttpServletResponse in my REST
service class ).
However, in all the cases, Jersey returns the String with content Type set
in response as MediaType.TEXT_XML.
If i annotate the method with @Produces({MediaType.APPLICATION_JSON,
MediaType.TEXT_XML}), it sets the content type as
MediaType.APPLICATION_JSON, so its setting the first media type.
Can someone help me out of here?
--
View this message in context: http://jersey.576304.n2.nabble.com/Jersey-setting-the-content-type-in-the-Response-tp5721923p5721923.html
Sent from the Jersey mailing list archive at Nabble.com.