hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
190 stars 98 forks source link

Extend ApplicationConfiguration to support getSingletons() #119

Closed col-panic closed 8 years ago

col-panic commented 8 years ago

In https://webdav-jaxrs.java.net/configuration.html it is required to register singletons for the jax-rs application. Within https://github.com/hstaudacher/osgi-jax-rs-connector/blob/master/bundles/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/ApplicationConfiguration.java you already support getProperties, could you include support for getSingletons?

thanks a lot

hstaudacher commented 8 years ago

Ok, now I get what you want after reading this webdav thing. I think the approach to add the getSingleton method to the ApplicationConfiguration is wrong. This is because the publisher makes use of singletons anyway. Each service that is annotated with @Path is registered as singleton within the Jersey Application.

All the webdav extension needs as far as I see it is to register the WebDavContextResolver and PersistenceExceptionMapper as singletons. So, basically you have to do the same thing we did with gson, swagger ands on on. Create a new bundle and call it "...provider.webdav". In it's activator simply register the 2 classes as OSGi services. The connector registers them as singletons and you should be done.

col-panic commented 8 years ago

thanks for the hint!! It worked out like that :)