Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.7.5
-
None
-
None
-
Unknown
Description
In case of next endpoint with @Context HttpServletResponse:
@GET @Path("test") @Produces(MediaType.TEXT_PLAIN) public void test(@Context HttpServletResponse response) throws IOException { response.setContentType(MediaType.TEXT_PLAIN); response.getOutputStream().print("test"); }
Content-Type in received message is always "text/xml":
[bash]$ curl "http://localhost:8030/test" -D -
HTTP/1.1 200 OK
Content-Type: text/xml;charset=UTF-8
Content-Length: 4
So it is impossible to change Content-Type when @Context is used.
response.setContentType(MediaType.TEXT_PLAIN) doesn't work as well as @Produces(MediaType.TEXT_PLAIN)