Hi,
On Wed, Jul 6, 2011 at 6:02 PM, rodgersh <[email protected]> wrote:
> Sergey -
>
> Thank you for the quick response.
>
> The injection of the HttpServletResponse and using its addHeader(...) method
> worked perfectly.
>
> Here's my updated code snippet:
>
> @javax.annotation.Resource
> private javax.servlet.http.HttpServletResponse servletResponse;
>
> Response.ResponseBuilder responseBuilder = Response.ok( queryResults );
>
> for ( String siteName : jsonProcessor.getStatusReportList().keySet() ) {
> String exceptionMessage = (String)
> jsonProcessor.getStatusReportList().get(
> siteName );
>
> //responseBuilder.header( "Warning", siteName + ": failed to execute
> query
> due to this exception: " + exceptionMessage );
> servletResponse.addHeader( "Warning", siteName + ": failed to execute
> query
> due to this exception: " + exceptionMessage );
> }
>
> response = responseBuilder.build();
>
I've added an "org.apache.cxf.http.add-headers" boolean property which
can be used to get all the individual header values (stored in the
map)
added as separate headers - right now this property is not set to true
given that it may 'upset' some existing code. Perhaps we can set it to
true by default a bit later on, given that one can do something like
Response.ok().header("a", "a1, a2, a3").build();
to get a single header only even if this property is set to true.
Response.ok().header("a", "a1").header("a", "a2").build();
would result in multiple 'a' headers.
So starting from 2.3.6/2.4.2 you can set a jaxrs:property and simplify
the code by dropping HttpServletReponse context reference...
Cheers, Sergey
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Same-HTTP-header-in-JAXRS-response-multiple-times-tp4556926p4557404.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
--
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend - http://www.talend.com