Hi On Wed, Jul 6, 2011 at 3:26 PM, rodgersh <[email protected]> wrote: > I have a requirement to add the same HTTP header multiple times to a JAXRS > response. For example, I need to add the HTTP header "Warning" to my JAXRS > response multiple times for each error detected: > > HTTP/1.1 200 OK > Content-Type: application/json > X-Total-Count: 1 > Warning: BADSITE-2: failed to execute query due to this exception: blah blah > Warning: BADSITE: failed to execute query due to this exception: more blah > Date: Wed, 06 Jul 2011 13:55:06 GMT > Content-Length: 436 > Server: Jetty(7.4.2.v20110526) > > > I have only been able to get the header to appear once. I have tried using > Response.ResponseBuilder.header(...) multiple times for each occurrence of > "Warning" header. I have also tried a single call to > Response.ResponseBuilder.header( "Warning", > <comma-delimited-list-of-warnings>) where each warning meessage's text is > delimited by a comma. > > In both cases I only get a single Warning HTTP header in the response, > either with the entire comma-delimited text in it or with the last warning's > text loaded in the http header. >
At the moment, injecting HttpServletResponse and adding headers directly might help, give it a try please. In meantime, I may need to introduce a configuration property which will provide a hint that headers with the same name can not be collapsed. Using HttpServletResponseWrapper at the servlet filter level may help if adding headers directly to HttpServletResponse does not work - let me know please if it does not Cheers, Sergey > Any help/suggestions would be appreciated. > > Thanks. > > -- > View this message in context: > http://cxf.547215.n5.nabble.com/Same-HTTP-header-in-JAXRS-response-multiple-times-tp4556926p4556926.html > Sent from the cxf-user mailing list archive at Nabble.com. > -- Sergey Beryozkin http://sberyozkin.blogspot.com Talend - http://www.talend.com
