users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Re: Interceptors vs composite MBR and MBW

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Tue, 15 May 2012 14:32:09 +0100

On 15/05/12 14:21, Santiago Pericas-Geertsen wrote:
>
> On May 15, 2012, at 4:50 AM, Marek Potociar wrote:
>
>>> At the moment I see the only limitation of composite MBRs & MBWs
>>> compared to reader/writer interceptors is that the former has no a
>>> standard mechanism for exchanging the properties with filters.
>>>
>>> Is it what others see too ? Anything else that I've missed ?
>>
>> I think that another significant difference is that in a composite
>> entity provider you need to manually select the proper (leaf) entity
>> provider to which you eventually delegate the (de)serialization work.
>> In interceptors this selection is done "for free" by the JAX-RS runtime.
>>
All the composite provider needs to do is to delegate to the injected
Providers to find the right provider which is nearly as free

>> Also, implementing a generic composite entity provider in a way that
>> it is always guaranteed to kick in when necessary, but at the same
>> time does not interfere with other providers if not needed is quite
>> tough due to the JAX-RS entity provider selection algorithm.
>
This is a good point I guess

> I agree. Interceptors greatly improve ease of use here. They provide
> additional extension points in the framework that are otherwise
> difficult to get right manually or may lead to code repetition (no code
> factoring).
>
OK. Hope this thread has been useful
Sergey

> -- Santiago
>