users@jersey.java.net

[Jersey] osgi issues with Jersey 2.0

From: phil swenson <phil.swenson_at_gmail.com>
Date: Tue, 29 Oct 2013 07:41:35 -0600

are any of these issues on the roadmap? asking for another team as they
say they can't upgrade to jersey 2


   1. 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.
   2. 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.
   3. 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.