[Jersey] Live registration of resources

From: Alexandre Borgoltz <>
Date: Wed, 6 Apr 2011 16:35:35 +0200


I am trying to use jersey as embedded in an OSGi engine (in an Eclipse RCP
application with jetty embedded actually).
I have developped a nice way to contribute REST resources to an application
via eclipse's extension mecanism.
Everything works fine except for one thing: resources registration.

The default behaviour is an automatic scan of WEB-INF/lib and classes. I
have written my own "Application" that replaces the scan of the classpath by
a scan of eclipse registry : works fine.
BUT it is a good practise in an OSGi environment to track registry changes,
instead of reading it once. I could do that cleanly, being notified
everytime a new REST resource is contributing - but I haven't found the way
to register these resources programmatically once the jersey engine

Can Jersey add resources *live* ? Or is it a limitation that you must know
the list of classes or singletons before it starts up?

I thank you in advance for your help!