[jax-rs-spec users] [jsr339-experts] Re: Re: Re: Re: Re: Re: Re: New to the group - comments on the current draft

From: Santiago Pericas-Geertsen <>
Date: Tue, 20 Dec 2011 16:48:05 -0500

On Dec 20, 2011, at 4:19 PM, Sastry Malladi wrote:

>> > Reader/WriterInterceptor sounds good. In fact even better than Handler.
>> >>OK. If there are no objections, I plan to make this change. It is clear that people are very confused by the term "handler". We should, however, avoid using >>the term "interceptor" on its own to avoid confusion with the more general CDI/EJB concept.
>> I'm good with this. BTW, did you give any thought around providing a "ResourceMethodInterceptor", for the lack of a better name. Basically, getting control just before calling the resource method and right after the method returns. This a very useful thing, especially to measure how long the resource method execution took.
> >> There's no need to add that to JAX-RS. Given that CDI and JAX-RS can be used together, you can just use interceptors from CDI for that [1].
> I'm perhaps missing something simple here, so please pardon my ignorance. I don't understand how this can be done, without the Resource providers putting anything (annotations) in their resource classes. What I'm trying to achieve is, in an operational environment, without requiring resource classes to do anything special (we can't rely on resource providers to put certain annotations in their classes), how do we measure the resource execution time, excluding the MBR and MBW times etc. I can write a CDI interceptor class, but how do we associate that interceptor class automatically to any resource method execution ?

 Yes, it would require adding annotations. Without any use of an API, I'm not sure this case belongs to the spec. I think this should better be handled by implementations or other tools (like profilers).

-- Santiago