users@jersey.java.net

[Jersey] Re: OSGi Export-Package: javax.ws.rs

From: Ryan Stewart <zzantozz_at_gmail.com>
Date: Mon, 30 May 2011 10:11:05 -0500

On Mon, May 30, 2011 at 9:55 AM, Jakub Podlesak
<jakub.podlesak_at_oracle.com>wrote:

> On 05/30/2011 03:22 PM, Ryan Stewart wrote:
>
> I only have a little experience with OSGi, so I may be totally off here,
> but it doesn't seem like RuntimeDelegate should block moving the JAX-RS
> stuff out of Jersey. According to RuntimeDelegate, the first way of
> specifying a RuntimeDelegate subclass is, "If a resource with the name of
> META-INF/services/javax.ws.rs.ext.RuntimeDelegate exists, then its first
> line, if present, is used as the UTF-8 encoded name of the implementation
> class." If you just add this file to each version of jersey-core pointing to
> an appropriate subclass, wouldn't that still allow you to run multiple
> jersey versions in parallel? Each version would be deployed as its own
> bundle, each of those bundles would import a common javax.ws.rs.*, and each
> would
>
>
> The *common* javax.ws.rs.* is the issue here, which we would like to avoid.
> The javax.ws.rs.ext.RuntimeDelegate class keeps the runtime delegate
> instance reference
> in a static variable, i.e. as long as various JAX-RS implementations share
> a single
> javax.ws.rs.ext.RuntimeDelegate class, they also share the very same
> runtime delegate
> instance.
>
> I see. Is there any hope of a solution to this? Might JAX-RS 2.0 provide a
better way? Or couldn't a RuntimeDelegate instance be designed that's
capable of managing resources across multiple bundle versions? i.e. build a
RuntimeDelegate that gets installed once, and afterward updates the
installed instance with new delegate objects keyed off of the ClassLoader
from which it was created?