Well you have to construct your Servlet objects to register them with the 
HttpService. Why not pass the BundleContext to the Servlet object during 
construction or shortly thereafter but before you register the Servlet 
object.
-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargr...@us.ibm.com

office: +1 386 848 1781
mobile: +1 386 848 3788




From:
"Pruitt, Byron S" <steve.pru...@hp.com>
To:
OSGi Developer Mail List <osgi-dev@mail.osgi.org>
Date:
2009/01/08 15:13
Subject:
RE: [osgi-dev] Servlet design pattern
Sent by:
osgi-dev-boun...@mail.osgi.org



I use the OSGi Http Service Specification to register my Servlets.  My 
question addresses more of what to after the Servlet gets a request and 
needs to access some OSGi service for instance.  I can't figure out a 
clean way to wire my Servlet up with the rest of the OSGi univers.

-S


-----Original Message-----
From: osgi-dev-boun...@mail.osgi.org [
mailto:osgi-dev-boun...@mail.osgi.org] On Behalf Of Niclas Hedhman
Sent: Wednesday, January 07, 2009 9:02 PM
To: OSGi Developer Mail List
Subject: Re: [osgi-dev] Servlet design pattern

On Thu, Jan 8, 2009 at 2:45 AM, Pruitt, Byron S <steve.pru...@hp.com> 
wrote:
> I'm developing an application with several bundles.  Some of them use 
the http service as the api for the outside world.
> I haven't found a good pattern for integrating Servlets with the rest of 
the OSGi framework.  After a request is received, I want to invoke OSGi 
services, etc.  I have experimented with singletons or initializing the 
Servlet with objects that "bridge" the Servlet to the services.
>
> Is there something better?  Am I missing something obvious?

Have you seen if the OSGi Http Service Specification meets your 
requirements?

If not, take a look at the Servlet Bridge by Simon Kaegi.

Also, you can embed Felix so that framework extensions, which are
loaded from your servlet with the embedding, can expose and use
services in the Felix instance. I guess Equinox can do the same, but I
don't know the details.


Cheers
Niclas
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to