users@jersey.java.net

Re: jersey-oauth, guice and OSGi

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Tue, 23 Nov 2010 10:46:51 +0100

Hi Carsten,

The OAuth Jersey modules should now (1.5-SNAPSHOT version) be OSGified.
Regarding OAuth provider instantiation issue, could you please file a
new bug report for that?

Thanks,

~Jakub

On 11/22/2010 09:18 AM, Carsten Saathoff wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all,
>
> I recently started to use Jersey for the development of a RESTful API. Since we require OAuth for authentification, we use the jersey-oauth modules. Our environment is OSGi and for dependency injection we use guice.
>
> Now I have mainly two questions. First of all, the jersey-oauth jars are not OSGi bundles. It's easy to convert them to bundles using the eclipse tooling, for instance, but I was wondering whether there are any plans to release them as OSGi bundles in the future?
>
> My second question is probably a bit more tricky (or a sign that I have not yet fully understood jersey). I wanted to inject some dependencies into the OAuthProvider using guice. However, when I register the OAuthProvider using the PROPERTY_PROVIDER resource configuration, instantiation of the provider is handled by jersey and not guice, and as a consequence nothing gets injected. My workaround for this is to throw away the OAuthProviderInjectionProvider, change the
>
> @Context OAuthProvider ...
>
> to
>
> @Inject OAuthProvider ...
>
> and use guice to inject the singleton instance of the OAuthProvider.
>
> That works, but is suboptimal, since I am working with a custom version of jersey-oauth now. Therefore I was wondering whether there is any standard way to solve this issue. I assume I have to let guice inject my own custom InjectionProvider for the OAuthProvider, for which I handle instantaition myself.
>
> Is that the proposed way? Will my custom InjectionProvider interfere with the implementation provided by jersey-oauth?
>
> Any insight is greatly appreciated.
>
> best regards
>
> Carsten
>
> - --
> Kreuzverweis - Media with a Meaning - http://www.kreuzverweis.com/
>
> EXIST Research Transfer, University of Koblenz-Landau
> Universitätsstr. 1, 56068 Koblenz, Germany
>
> phone: +49 451 3998470 fax: +49 261 2871002795
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
>
> iEYEARECAAYFAkzqJ1QACgkQSyub37CCki6UlgCg2tr7OpIkP33d/lM88Xv9yUVA
> 7zMAoNzj6VckHUjD3LQ1IGgXfd/oMXOB
> =70+7
> -----END PGP SIGNATURE-----
>