users@jersey.java.net

Re: [Jersey] Decorating Resource Methods in Jersey

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 27 Oct 2009 09:09:26 +0100

Hi Mark,

Jersey does contain a feature called resource filters [1], but i am
not sure that is suitable for all your requirements.

To support interceptors you need to use an AOP library or say use
Guice that has good support for interceptors.

Paul.

[1] https://jersey.dev.java.net/nonav/apidocs/1.1.2-ea/jersey/com/sun/jersey/api/container/filter/package-summary.html

[2] https://jersey.dev.java.net/nonav/apidocs/1.1.2-ea/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/package-summary.html

http://code.google.com/docreader/#p=google-guice&s=google-guice&t=AOP

On Oct 27, 2009, at 3:31 AM, Mark Maxey wrote:

> Is there a way to "wrap" an arbitrary resource method? I have a use
> case where I'd like to intercept the method Jersey is about to call,
> wrap it with some custom decorators, and then call the decorated
> method. These decorators act like a container managing
> transactions, non-JSR 311 exceptions, etc.
>
> Alternatively, I could use some type of handler/interceptor that
> allows me to inject custom logic before and after an arbitrary
> resource method is called.
>
>
> Thanks in advance,
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>