users@jersey.java.net

[Jersey] Re: osgi issues with Jersey 2.0

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Tue, 5 Nov 2013 21:32:25 +0100

Hi Phil,

As a rule of thumb - filing new issues typically helps to get bugs fixed. Have you filed bugs for any of your complaints?

Now to address your concerns more specifically.

Ad 1. I have filed a new JERSEY-2169 issue to make the UriSchemeResourceFinderFactory API public and supported. This is a clear omission on our end. We did not find enough time yet to decide if we want to make the migrated API public in the current form. I'm sorry for that.

Ad 2. You should be able to inject ServletContext into your Application. If not, please file a bug.

Ad 3. What do you mean by "OSGi JAX-RS Connector"? This: https://github.com/hstaudacher/osgi-jax-rs-connector ? If yes, please understand that the code is not owned, implemented or maintained by Jersey team.

Marek

On 29 Oct 2013, at 14:41, phil swenson <phil.swenson_at_gmail.com> wrote:

> are any of these issues on the roadmap? asking for another team as they say they can't upgrade to jersey 2
>
> Jersey 2 still does not support the equinox specific bundleentry URI which is required in order to be able to use the packages scanning capabilities of Jersey (e.g. list packages containing resources/providers in web.xml and dynamically register the containing resources/providers). The same issue was present i Jersey 1.x but there was an option to register custom URI Schema Scanner using the com.sun.jersey.core.spi.scanning.uri.UriSchemeScanner class. However, Jersey 2 has "TODO" comments for such SPIs and users are unable to register custom URI Schema Scanners. This means that equinox users cannot use the packages scanning option and should list each resource/provider explicitly.
> As another solution for the URI issue in 2. and also for faster resources startup time in Jersey 1.x we used a CCApplication which uses WebConig and ServletContext injected with @Context. Using the injected context instances we were able to get the listed packages from web.xml and dynamically register the containing providers/resources. However, for some reason Jersey 2 cannot inject any @Context instances in ResourceConfig/Application and we cannot get access to the init-params (including the listed packages) from web.xml file.
> OSGI JAX-RS Connector does not work in Jersey 2. Trying to access a resource fails with "java.lang.IllegalStateException: The resource configuration is not modifiable in this context.". Debugging shows that internally Jersey uses "ImmutableState" objects which cannot be modified by the OSGi JAX-RS Connector. Note that the connector works fine in Jersey 1.x.