[jax-rs-spec users] [jsr339-experts] Re: ResponseBuilder and setting headers

From: Marek Potociar <>
Date: Wed, 14 Dec 2011 14:42:13 +0100

Irrespective of the usefulness of the proposed method, isn't your use case solved by the fact that filter context can
return current response as a ResponseBuilder with all the original headers and stuff pre-filled? IOW:



On 12/14/2011 11:30 AM, Sergey Beryozkin wrote:
> Hi
> I'd like to propose adding
> ResponseBuilder.headers(ResponseHeaders allHeaders)
> and/or
> ResponseBuilder.headers(MultivaluedMap<String, String> allHeaders)
> method(s).
> One thing I found while advising users how to override a Response in custom out filters is that one need to enumerate
> over all the headers of the current Response in order to copy them over to a new one, the following would simplify it a
> lot IMHO:
> return Response.status(oldResponse.getStatus())
> .headers(oldResponse.headers())
> .entity(updateEntity(oldResponse.getEntity()))
> .build();
> Sergey