[jax-rs-spec users] [jsr339-experts] Re: Interceptor Invocation and CDI

From: Santiago Pericas-Geertsen <>
Date: Tue, 23 Oct 2012 15:55:09 -0400


 Interesting questions. Here's my take on them:

> For example, if using
> @Inject Instance<MessageBodyReader> mbrs;
> for(MessageBodyReader mbr : mbrs) {
> if(mbr.canRead( ... ) ) {
> someObject = mbr.readFrom( ... )
> }
> }
> is the expectation that any applicable JAX-RS interceptors are invoked?

 I don't think so. JAX-RS entity interceptors are not method interceptors, they are part of the JAX-RS processing pipeline. For method interceptors, use CDI.

> What about ordering/interference with CDI Interceptors?

 For example CDI interceptor(s) for readFrom()? They should be called after the entity interceptors (in the normal processing pipeline), when JAX-RS calls the CDI bean method. Their ordering, if there's more than one, should be defined by the CDI spec (which I believe they are doing now).

-- Santiago