You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2013/07/15 22:24:49 UTC

[jira] [Resolved] (CXF-5129) Content type is always "text/xml" in case of using @Context HttpServletResponse response

     [ https://issues.apache.org/jira/browse/CXF-5129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-5129.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0.0
                   2.7.6
         Assignee: Sergey Beryozkin

Fixed; FYI, my tests show that if you specify HTTP 'Accept', which is not done in your example, then it also works... thanks
                
> Content type is always "text/xml" in case of using @Context HttpServletResponse response
> ----------------------------------------------------------------------------------------
>
>                 Key: CXF-5129
>                 URL: https://issues.apache.org/jira/browse/CXF-5129
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.7.5
>            Reporter: Sergei Malafeev
>            Assignee: Sergey Beryozkin
>             Fix For: 2.7.6, 3.0.0
>
>
> In case of next endpoint with @Context HttpServletResponse:
> {code}
> @GET
> @Path("test")
> @Produces(MediaType.TEXT_PLAIN)
> public void test(@Context HttpServletResponse response) throws IOException {
>        response.setContentType(MediaType.TEXT_PLAIN);
>        response.getOutputStream().print("test");
> } 
> {code}
> Content-Type in received message is always "text/xml":
> {code}
> [bash]$ curl "http://localhost:8030/test" -D -
> HTTP/1.1 200 OK
> Content-Type: text/xml;charset=UTF-8
> Content-Length: 4
> {code}
> 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)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira