Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Re: how to get a bundle's root file path?
Re: how to get a bundle's root file path? [message #85172] Mon, 26 March 2007 20:19 Go to next message
David Donohue is currently offline David DonohueFriend
Messages: 104
Registered: July 2009
Senior Member
The above workaround does not generally work.

I am at a loss.
Is there a way for a bundle to find out its absolute file path?

I would think BundleContext could provide a getAbsolutepath() method

Thanks,
David
Re: how to get a bundle's root file path? [message #85213 is a reply to message #85172] Mon, 26 March 2007 21:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

Why should you assume that a bundle has a file path? I have bundles running directly from SQL databases and remote webservers.

Perhaps it would be better if you took a step back and explained what it is that you're trying to achieve?

Alex.
Re: how to get a bundle's root file path? [message #85228 is a reply to message #85213] Mon, 26 March 2007 23:21 Go to previous messageGo to next message
David Donohue is currently offline David DonohueFriend
Messages: 104
Registered: July 2009
Senior Member
> I have bundles running directly from SQL databases and remote webservers.

Wow I didn't know that's possible. I was trying to configure a jetty 6.0 server using this

WebAppContext webappcontext = new WebAppContext("c:/absolute/path/to/webdir/","/");

I suppose I will have to find a different way to configure a Jetty WebAppContext

David
Re: how to get a bundle's root file path? [message #85303 is a reply to message #85228] Tue, 27 March 2007 09:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

OK, next question; why are you trying to configure a Jetty WebAppContext?

Alex.
Re: how to get a bundle's root file path? [message #85331 is a reply to message #85303] Tue, 27 March 2007 10:32 Go to previous messageGo to next message
David Donohue is currently offline David DonohueFriend
Messages: 104
Registered: July 2009
Senior Member
Alex,
Again my thanks. You asked for it :]

I am trying to configure a Jetty WebAppContext because that is the easiest way to construct my freestanding, pluggable, Velocity + Jena web application. So the app I am designing is a Velocity web-based administrative interface in front of a Jena RDF database. It has an OSGi/Equinox backbone, with a core plugin which is the Jetty 6.1.1 server + Velocity + Jena + DB libraries. Users can construct plugins that consist of Java classes + Velocity template web files, and thereby plug functionality into the app. Such new functionality would include new visualization modules, new data loading modules, and many others.
David
Re: how to get a bundle's root file path? [message #85361 is a reply to message #85331] Tue, 27 March 2007 13:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

That's sales blurb, not a technical reason :-)

What is it that you're trying to specifically configure for the WebAppContext? In other words, could there be a better way of doing this configuration that you're not aware of?

Lots of people (including the new help pages in Eclipse 3.3M6) use Jetty as a back end -- there's the org.eclipse.equinox.http.jetty bundle, which I'm assuming you're using. There should be no reason why you have to try and configure a WebAppContext.

So, going back to the question; what are you trying to configure in a WebAppContext?

Alex.
Re: how to get a bundle's root file path? [message #85383 is a reply to message #85361] Tue, 27 March 2007 14:15 Go to previous messageGo to next message
Richard Backhouse is currently offline Richard BackhouseFriend
Messages: 19
Registered: July 2009
Junior Member
Actuallt there is if you want to mimic a real webcontainer environment
that supports multiple "webapplications" each with their own web.xml and
libraries. The Jetty api provides programatic support for doing this
sort of thing.

Richard

Alex Blewitt wrote:
> There should be no reason why you have to try and configure a WebAppContext.
Re: how to get a bundle's root file path? [message #85402 is a reply to message #85361] Tue, 27 March 2007 14:26 Go to previous messageGo to next message
David Donohue is currently offline David DonohueFriend
Messages: 104
Registered: July 2009
Senior Member
Alex,

I tried the org.eclipse.equinox.http.jetty bundle but had problems with it. I am using my own core plugin which simply uses the Jetty 6.1.1 jars. I have this working/running from within Eclipse.

I am trying to configure the WebAppContext in the manner it is expected to be configured: to use the WEB-INF/web.xml file to specify which servlets will match which URL context paths, and to point to the Velocity specific configuration files (WEB-INF/toolbox.xml and WEB-INF/velocity.properties).

I am sure there is a way to programmatically configure a Jetty WebAppContext without web.xml and to then programmatically configure Velocity without toolbox.xml and velocity.properties, however this will take me more time to learn than if I can get the absolute path and use this simpler code
WebAppContext webappcontext = new WebAppContext("absolute/path/to/my/webroot","/");

I am working on doing it the programmatic way.
Thanks,
David
Re: how to get a bundle's root file path? [message #85447 is a reply to message #85402] Tue, 27 March 2007 15:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

I think you'd be better off trying to get it working with the Jetty jars, in the way that the help server runs web applications. You can't always guarantee a path to a file (e.g. if the bundle is Jar'd up) so the approach of trying to derive a path isn't also guaranteed.

If you really want files, you're best off extracting some kind of template to the PluginStateLocation, which will be a file system with a real path and thus you can pass that in instead. It just means when running, your Jar needs to be auto-unzipped to there.

I'd suggest moving towards using the Jetty one rather than bundling your own in and reporting issues that you have with that ...

Have you seen this?

http://www.eclipsezone.com/eclipse/forums/t62852.html

Alex.
Re: how to get a bundle's root file path? [message #85462 is a reply to message #85402] Tue, 27 March 2007 15:47 Go to previous message
Eclipse UserFriend
Originally posted by: alex_blewitt.yahoo.com

I think you'd be better off trying to get it working with the Jetty jars, in the way that the help server runs web applications. You can't always guarantee a path to a file (e.g. if the bundle is Jar'd up) so the approach of trying to derive a path isn't also guaranteed.

If you really want files, you're best off extracting some kind of template to the PluginStateLocation, which will be a file system with a real path and thus you can pass that in instead. It just means when running, your Jar needs to be auto-unzipped to there.

I'd suggest moving towards using the Jetty one rather than bundling your own in and reporting issues that you have with that ...

Have you seen this?

http://www.eclipsezone.com/eclipse/forums/t62852.html

Alex.
Previous Topic:log4j bundle
Next Topic:Mapping all URLs to one servlet
Goto Forum:
  


Current Time: Fri Dec 27 00:59:10 GMT 2024

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

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

Back to the top