users@jersey.java.net

Re: Security Interceptors

From: Lars Tackmann <ltackmann_at_gmail.com>
Date: Tue, 25 Mar 2008 11:51:35 +0100

On Sun, Mar 23, 2008 at 5:55 PM, Martin Grotzke
<martin.grotzke_at_javakaffee.de> wrote:
> Hi Lars,
>
> one thing I could think of is to implement your own component provider,
> that checks if the class to instantiate has your @Interceptors
> annotation or any method has e.g. your @Audit annotation. For these
> classes you could return a proxied instance (e.g. using cglib), so that
> you can intercept method invocations.

Just out of curiosity if I do somthing such as:

--
@Path("{id}"/)
public NestedResource getNestedResource(@PathParam("id") Long id) {
    NestedResource res = injector.getInstance(NestedResource.class);
    res.setId(id);
    res.setUriInfo(uriInfo); // similar with HTTPHeaders...
    return res;
}
--
then the guice interceptors will come into play and let me intercept
methods annotated with @Audit. Now if Guice then could actually create
the resources that Jersey handles today then I suppose I have a
solution. I can of cause mix this with the provider hack but that
seams to be a ugly mix.
any thoughts ?
-- 
Yours sincerely
Lars Tackmann