users@jersey.java.net

Re: [Jersey] Passing my own non-static objects into jersey resources and providers ?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 03 May 2010 14:28:46 +0200

On May 3, 2010, at 2:18 PM, Morten wrote:

> --- Den man 3/5/10 skrev Paul Sandoz <Paul.Sandoz_at_Sun.COM>:
>> You can add singleton instances to the Application.
>
> Thanks, I tried it and this works for singletons. I was not aware of
> this (all constructors and examples I could find only used classes).
>
>> You can register your own injectables by implementing:
>> https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/spi/inject/InjectableProvider.html
>
> The problem is then moved to how to pass the state to the
> InjectableProvider but I guess if it is a singleton then the above
> trick with adding singletons to applications will work.
>

Correct.


>> Is that the one i fixed related to class hierarchies?
>
> Yes! (The one that was so complicated to verify last week as we
> found out I could not bundle a new version of jersey with my app in
> glassfish). As I wrote to you I have come to realize that the Jersey
> integration with dependency managers and glassfish is too cutting
> edge. Once your bugfix is in a released version of jersey and a new
> glassfish version is there with the new jersey version and all
> customers has upgraded I am sure it will work but until then I will
> either have to live with the problem or try a workaround. And the
> workaround I am trying is a simpler setup.
>

OK.

Paul.