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

[jsr339-experts] Re: interceptors

From: Guilherme Silveira <guilherme.silveira_at_caelum.com.br>
Date: Fri, 4 Mar 2011 11:51:34 -0300

Hi Bill,

> - Pre-process before matching
> - Around MessageBodyReader
> - Around MessageBodyWriter
> - After method was called before marshalling (not sure if we ever had a
> usecase for this)
Are those methods defined within the Interceptor interface or
different interceptor interfaces?

Regards

Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/



On Fri, Mar 4, 2011 at 11:37 AM, Bill Burke <bburke_at_redhat.com> wrote:
> In resteasy, we found that Filters and CDI were not good enough for our
> needs of interception.  We wanted to be able to trigger interceptions of the
> HTTP request at different points depending on what annotations were applied
> to a JAX-RS method.
>
> * We couldn't use Filter in many situations because there's no way to
> trigger/bind a Filter based on an annotation specified on a JAX-RS method.
>
> * I don't know if Servlet 3.0 fixed this, but originally, Filters didn't
> work with Async HTTP.  Resteasy has Async HTTP integration of its own that
> we hope to standardize.
>
> * We couldn't use CDI because we needed different types of interception
> points were needed:  Before the method was called or even matched
> (security).  Or specific to (un)marshalling (wrapping
> MessageBodyReader/Writer invocations).
>
> * We wanted something that could be re-used on the client side.
>
> So, we defined 4 interception points:
>
> - Pre-process before matching
> - Around MessageBodyReader
> - Around MessageBodyWriter
> - After method was called before marshalling (not sure if we ever had a
> usecase for this)
>
> MessageBodyReader/Writer interception was used for things like:  gzip
> encoding, digital signatures, caching.  Many of these worked on both the
> client and server side.
>
> pre-process interception was used for: caching, security plugins.
>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>