Hi Lars,
I would really like if possible to defer such support to an IoC
container so we do not have to re-implement such functionality.
I wonder if an IoC container could manage an existing instance of
something, for example:
// Manage an instance created by something else
Object manage(Object o)
Then Jersey can pass the instance returned by a sub-locator for
management to an IoC container.
Anybody know if that is possible in Spring/Guice/WebBeans ?
Paul.
On Mar 25, 2008, at 11:38 AM, Lars Tackmann wrote:
> 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.
>
> Hi Martin
>
> Thanks for the suggestion, it does indeed seam to work, the problem
> with nested resources is however quite annoying as I have heap of
> those. It might be an idea for the JAX-RS spec people to consider
> adding interceptor support similar to the one found in EJB i.e.
>
> http://java.sun.com/javaee/5/docs/api/javax/interceptor/package-
> summary.html
>
> and particularly:
>
> http://java.sun.com/javaee/5/docs/api/javax/interceptor/
> InvocationContext.html
>
> This could also fit neatly with the provider scheme as it would let me
> intercept the parameters/result and do what ever kind of conversion I
> deem necessary. Anyway until a better solution exists I will just
> apply my security progmatically inside each method.
>
>
> --
> Yours sincerely
>
> Lars Tackmann
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>