wink-osgi use cases

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

wink-osgi use cases

andyatmiami
Greetings,

I am keeping details brief because this mail list seems used very infrequently, and the IRC channel listed under the Community information appears abandoned.  I can provide more details as necessary should someone be able to assist me.

Short story, I am interested in using the wink-osgi bundle provided - but the example project included does not fit my needs.  I want to preserve the "new instance per request" functionality we currently leverage with Wink.

In viewing source, I see this comment:

*
* This component listens to registrations of services of type <code>java.lang.Object</code>
* with the property <code>javax.ws.rs</code> set to true and registers them with the
* Wink RequestProcessor. Root resources and providers that are not exposed as such a service
* can be registered by invoking the bindComponent method.
*
* Alternatively Jax-RS resources can be registered by their class. This supports
* having root-resources with a per request life cycle. The method to use is
* <code>bindComponentClass</code>.
*
*/

However, I don't find any examples actually using this 'bindComponentClass' method, so I am unclear how to start.  Additionally, I presently use a customized Application class and WinkServlet class.  In this OSGi application of Wink, how do I override these classes to preserve my customizations?

Thanks!

Andy
Reply | Threaded
Open this post in threaded view
|

Re: wink-osgi use cases

Reto Gmür
Hi Andy,

In general I would avoid the "one instance per request" pattern, but if you want to stick with it you should be able to get an instance of the WinkRequestProcessor service and register all you components (root resource classes, message body writers, etc) by invoking process.bindComponentClass(MyResource.class).

I don't think you can currently register an application as a whole.

Cheers,
Reto

On Wed, Dec 3, 2014 at 9:47 PM, Andy Stoneberg <[hidden email]> wrote:
Greetings,

I am keeping details brief because this mail list seems used very infrequently, and the IRC channel listed under the Community information appears abandoned.  I can provide more details as necessary should someone be able to assist me.

Short story, I am interested in using the wink-osgi bundle provided - but the example project included does not fit my needs.  I want to preserve the "new instance per request" functionality we currently leverage with Wink.

In viewing source, I see this comment:

*
* This component listens to registrations of services of type <code>java.lang.Object</code>
* with the property <code>javax.ws.rs</code> set to true and registers them with the
* Wink RequestProcessor. Root resources and providers that are not exposed as such a service
* can be registered by invoking the bindComponent method.
*
* Alternatively Jax-RS resources can be registered by their class. This supports
* having root-resources with a per request life cycle. The method to use is
* <code>bindComponentClass</code>.
*
*/

However, I don't find any examples actually using this 'bindComponentClass' method, so I am unclear how to start.  Additionally, I presently use a customized Application class and WinkServlet class.  In this OSGi application of Wink, how do I override these classes to preserve my customizations?

Thanks!

Andy