Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Accesing OSGi from a Servlet
Accesing OSGi from a Servlet [message #87303] Tue, 01 May 2007 20:27 Go to next message
Eclipse UserFriend
Originally posted by: peter.brester.pixtor.org

Hi,

So I finally got Jetty to be running bundled with Equinox!

But I want to access other OSGi components from my servlet, and I dont
really understand how this can be done.
A simple example on how to use the log service (or something similar) from
my servlet would be appreciated.

BR

P
Re: Accesing OSGi from a Servlet [message #87707 is a reply to message #87303] Sun, 06 May 2007 18:56 Go to previous message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Hi Peter,

If you want your servlet to interact with other OSGi components then you'll
need a BundleContext.
Probably the easiest approach is to add an Activator to your bundle and
stash the bundle context in a static. You can then access the context
statically from your servlet e.g. Activator.getBundleContext().

I don't have a concrete example of what you're looking for however with an
accesible bundlecontext you could create and open a log service Service
Tracker in your servlet's init method and then use it as you see fit.

HTH
-Simon


"Peter B" <peter.brester@pixtor.org> wrote in message
news:f187s6$rmd$1@build.eclipse.org...
> Hi,
>
> So I finally got Jetty to be running bundled with Equinox!
>
> But I want to access other OSGi components from my servlet, and I dont
> really understand how this can be done.
> A simple example on how to use the log service (or something similar) from
> my servlet would be appreciated.
>
> BR
>
> P
>
>
>
Previous Topic:developing fragments in pde
Next Topic:Jetty Logs
Goto Forum:
  


Current Time: Sat Apr 27 02:58:55 GMT 2024

Powered by FUDForum. Page generated in 0.02870 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top