cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abdelgadiri (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5201) jaxrs2: unable to intercept response to add new response headers
Date Mon, 19 Aug 2013 20:39:49 GMT

    [ https://issues.apache.org/jira/browse/CXF-5201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13744188#comment-13744188
] 

abdelgadiri commented on CXF-5201:
----------------------------------

interesting to know! however:

1. behaviour with respect to writing to headers after writing to stream is fine when size
of payload is below a certain threshold. Since this is incorrect behaviour as you suggest
then cxf should complain e.g., by throwing an illegalstateexception when one attempts to set
headers after writing to stream. It also make the behaviour consistent irrespective of payload
size.
2. I can not find this behaviour documented anywhere in the spec for jsr-339, for example
see https://javaee-spec.java.net/nonav/javadocs/javax/ws/rs/ext/WriterInterceptorContext.html
3. how is this different from calling context.proceed() which will also end up writing to
the output stream? to my knowledge you should be able to set headers after calling context.proceed()



                
> jaxrs2: unable to intercept response to add new response headers
> ----------------------------------------------------------------
>
>                 Key: CXF-5201
>                 URL: https://issues.apache.org/jira/browse/CXF-5201
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.5, 2.7.6
>         Environment: windows
>            Reporter: abdelgadiri
>            Assignee: Sergey Beryozkin
>         Attachments: bug4986-1.0.war, bug4986.zip
>
>
> In a WriterInterceptor, one expects to be able to modify response headers via:
> //here using putSingle() but could also use on of the addXXX variants
> context.getHeaders().putSingle("headerName", headerValue);
> However, above is not working in 2.7.5/2.7.6 (@see JIRA-4986)
> As a workaround, one should be able to inject the HttpServletResponse object via: @Context
HttpServletResponse response;
> then be able to add headers directly to the response object e.g.,
> response.setHeader("headerName", headerValue);
> however, above is also not working in (2.7.5/2.7.6). This is not always reproducable
as sometimes my client does see the new headers in the received response. On closer look it
seems the added headers get lost when it is a @GET request as opposed to e.g., a @POST. Basically,
my test case (a @GET) always fails with a missing header in the received response even though
I am pretty sure the server had added the header. 

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