cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergei Malafeev (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CXF-5129) Content type is always "text/xml" in case of using @Context HttpServletResponse response
Date Mon, 15 Jul 2013 15:20:49 GMT

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

Sergei Malafeev updated CXF-5129:
---------------------------------

    Description: 
If use next endpoint:

{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}

Then 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 if using @Context.

  was:
If use next endpoint:

@GET
@Path("test")
@Produces(MediaType.TEXT_PLAIN)
public void test(@Context HttpServletResponse response) throws IOException {
       response.setContentType(MediaType.TEXT_PLAIN);
       response.getOutputStream().print("test");
} 

Then 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 if using @Context.

    
> 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
>
> If use next endpoint:
> {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}
> Then 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 if using @Context.

--
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

Mime
View raw message