users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Refactor MessageBodyHandlerContext.getHeaders()

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Mon, 19 Dec 2011 18:15:11 +0100

+1 Marek.

On 12/19/2011 04:31 PM, Bill Burke wrote:
> The MessageBodyHandlerContext.getHeaders() method needs to be removed. New methods in ReadFrom and WriteToHandler
> Context need to be added to match the corresponding MessageBodyReader and Writer interfaces:
>
> interface ReadFromHandlerContext {
>
> MultivaluedMap<String, String> getHeaders();
>
> }
>
> interface WriteToHandlerContext {
>
> MultivaluedMap<String, Object> getHeaders();
>
> }
>
> Why this change? Writers are allowed to add headers to the outgoing request (client) or response (server). In this
> scenario, they may want to interact using the Object representation of the header rather than the String based one.
>
> Readers will always be dealing with a String based representation of headers. Finally, this whole change maps 1-1 to
> the corresponding parameters that MessageBodyReader and MessageBodyWriters expect.
>
> http://java.net/jira/browse/JAX_RS_SPEC-151
>