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 specify its own RuntimeDelegate subclass. Then the bundles using
Jersey can specify a Jersey version, and whichever versions they use, the
appropriate subclass would be used.
Like I said, I may be off my rocker. I'd need to experiment some to see if
that would work the way I think.
On Mon, May 30, 2011 at 6:52 AM, Jakub Podlesak
<jakub.podlesak_at_oracle.com>wrote:
> Hi Ryan,
>
> We have added the javax.ws.rs.* stuff to the jersey-core bundle in order to
> be able to support
> running multiple Jersey versions in parallel (still need to get rid of the
> DynamicImport-Package:*
> header). The main issue here is that the RuntimeDelegate class from JAX-RS
> only allows you to register a single implementation instance.
> Bundling JAX-RS classes with jersey-core should help us overcome this
> issue.
>
> Regarding your issue with using other bundles, which import javax.ws.rs
> ;version="1.1.1",
> i think we can fix that by including proper version in the jersey-core's
> export headers.
> I actually think, that we got to fix that anyway.
>
> ~Jakub
>
>
> On 05/27/2011 10:48 PM, Ryan Stewart wrote:
>
> Why is it that jersey-core includes the javax.ws.rs.* packages and exports
> them as, for example, javax.ws.rs;version="0.0.0"? Whether using OSGi or
> not, isn't it more correct to indicate that jersey-core has a transitive
> dependency on jsr311-api-1.1.1? And specifically in OSGi, I've been
> encountering trouble trying to use other bundles that specifically import
> javax.ws.rs;version="1.1.1". Since everything in jersey explicitly depends
> on this bogus "0.0.0" version, there's no way to resolve the jersey bundles
> in the same container as the others in a way that they'll play together
> nicely. Can we remove javax.ws.rs.* from the jersey jars please?
>
>
>