users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Headers in ReaderInterceptor - read-only or not?

From: Bill Burke <bburke_at_redhat.com>
Date: Fri, 08 Feb 2013 14:43:53 -0500

On 2/8/2013 5:37 AM, Sergey Beryozkin wrote:
> On 08/02/13 10:35, Marek Potociar wrote:
>> Hello experts,
>>
>> please review the issue bellow:
>> http://java.net/jira/browse/JAX_RS_SPEC-268
>>
>> In summary, currently ReaderInterceptorContext.getHeaders() are
>> documented to return a *mutable* header map. We have seen the use case
>> in Jersey where mutability is useful. OTOH, Sergey argues that the
>> returned headers should be immutable to avoid potential side-effects
>> (see the issue comments for more reasoning).
>>
>> Please share your opinion on the subj. so that we can resolve the issue.
>>
>> Bill, interceptors is something that was inspired by RestEASY. What is
>> your take on this? While the API docs of your MessageBodyReaderContext
>> is, let's say, concise :) it is at least obvious that you provide a way
>> how to modify Content-Type (via setMediaType()), which would be in line
>> with the use case we saw in Jersey.
>>
>
> Sorry, I've already resolved it as Fixed on your behalf again;
> That said - thanks for initiating the thread, if someone has some
> specific concerns then I guess we can Re-Fix it somehow yet again :-)
>

They should be mutable so that an interceptor can trigger specific MBR
processing if required. i.e. specify a default char set, etc.

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com