Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » [server] get bundle inside a servlet
[server] get bundle inside a servlet [message #67782] Sat, 20 May 2006 13:32 Go to next message
Martin Lippert is currently offline Martin LippertFriend
Messages: 124
Registered: July 2009
Senior Member
Hi,

I am currently integrating Spring into the OSGi + servlet bridge world
and it works pretty fine. I got the Dispatcher servlet from Spring
running fine from within a spring bundle that lives inside the OSGi
world inside a jetty.

However I somehow need to find out which bundle contributed the servlet
to the extension point of the bridge (to find some special context
definition files for web-apps for Spring) from within the servlet.

What I am doing right now is to set a the bundle id as an init-param.
Then I could easily read this init-param later on to get the bundle
instance. But therefore I changed the bridge code to set this param. Is
there a better or less intrusive way of doing this?

(of course I could set the init-param inside the extension definition
and set the bundles symbolic name into it but that would mean to always
type the bundle name manually into the extension definition)

Thanks in advance!

Best regards,
-Martin
Re: [server] get bundle inside a servlet [message #67801 is a reply to message #67782] Mon, 22 May 2006 12:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: skaegi.sympatico.ca

Hi Martin,
You might be able to use PackageAdmin.getBundle(Class) if you have access
to a bundlecontext. Another approach would be to find the matching servlet
extension in the extension registry and from there find the contributing
bundle.
-Simon
Re: [server] get bundle inside a servlet [message #68103 is a reply to message #67801] Thu, 25 May 2006 11:05 Go to previous message
Martin Lippert is currently offline Martin LippertFriend
Messages: 124
Registered: July 2009
Senior Member
Hi Simon,

> You might be able to use PackageAdmin.getBundle(Class) if you have
> access to a bundlecontext. Another approach would be to find the
> matching servlet extension in the extension registry and from there find
> the contributing bundle.

PackageAdmin does not work in this situation because the servlet is
defined in a library plugin (Spring) and the extensions (with the
additional files to be found) are defined in other bundles.

Find the matching servlet extension seems to be the way. But from having
only the servlet context and config how can I identify the matching
extension?

Thanks for the help!

Best regards,
-Martin
Previous Topic:Should PDE cache startup state of bundles?
Next Topic:run osgi config error
Goto Forum:
  


Current Time: Fri Apr 19 11:03:43 GMT 2024

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

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

Back to the top