users@jax-rs-spec.java.net

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

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Wed, 14 Dec 2011 10:30:06 +0000

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