jsr339-experts@jax-rs-spec.java.net

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

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Tue, 15 May 2012 09:21:29 -0400

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.
>
> 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.

 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).

-- Santiago