Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » HttpContext outside of plugin bundle(registerResources to register a directory outside of plugin bundles)
icon5.gif  HttpContext outside of plugin bundle [message #546460] Mon, 12 July 2010 21:33 Go to next message
Brett Meyer is currently offline Brett MeyerFriend
Messages: 3
Registered: July 2010
Location: Fort Wayne, IN
Junior Member
Hello! Thanks in advance for any info available...

We're trying to figure out how to create a Jetty HttpService allowing access outside of all plugin bundle contexts.

More specifically, multiple plugins are able to store video files into C:\eclipse\uploads. All videos need to be served-up as resources, using something like <server>.registerResources("/uploads", "C:\eclipse\uploads", ???);

I realize this might effectively create a context exposing all of the filesystem...

We've looked extensively for examples and aren't having much luck. Can anyone shed some light on it? Thanks again!

[Updated on: Mon, 12 July 2010 21:43]

Report message to a moderator

Re: HttpContext for all of filesystem [message #546483 is a reply to message #546460] Tue, 13 July 2010 06:17 Go to previous messageGo to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 486
Registered: July 2009
Location: San Francisco ✈ Germany
Senior Member

Hi Brett,

Am 12.07.2010 23:33, schrieb Brett Meyer:
> [...] something like <server>.registerResources("/uploads", "C:\eclipse\uploads", ???);

There is a ResourceServlet in the org.eclipse.equinox.http.helper
plug-in (available in CVS) that you can use for this purpose.

-Gunnar

--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
Re: HttpContext for all of filesystem [message #546630 is a reply to message #546483] Tue, 13 July 2010 15:13 Go to previous messageGo to next message
Brett Meyer is currently offline Brett MeyerFriend
Messages: 3
Registered: July 2010
Location: Fort Wayne, IN
Junior Member
Thanks gunnar, but I'm a little confused on its use.

1.) When we init ResourceServlet, what ServletConfig do we give it that would allow external FS access?
2.) I see ResourceServlet doing this: String resourcePath = internalName + httpRequest.getPathInfo();
Does this mean we should initialize it with internalName as, for instance, "C:\eclipse\uploads"?

Thanks again!
Re: HttpContext for all of filesystem [message #546750 is a reply to message #546630] Wed, 14 July 2010 05:50 Go to previous messageGo to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 486
Registered: July 2009
Location: San Francisco ✈ Germany
Senior Member

Am 13.07.2010 17:13, schrieb Brett Meyer:
> 1.) When we init ResourceServlet, what ServletConfig do we give it that would allow external FS access?

No special config. It will be set by the HttpService when you register
the servlet.

> 2.) I see ResourceServlet doing this: String resourcePath = internalName + httpRequest.getPathInfo();
> Does this mean we should initialize it with internalName as, for instance, "C:\eclipse\uploads"?

You need to modify the implementation. #writeResource still calls
ServletContext#getResource. You simply need a #writeResource
implementation that reads the file directly from your file-system location.

-Gunnar

--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
Re: HttpContext for all of filesystem [message #546895 is a reply to message #546750] Wed, 14 July 2010 14:05 Go to previous message
Brett Meyer is currently offline Brett MeyerFriend
Messages: 3
Registered: July 2010
Location: Fort Wayne, IN
Junior Member
Gunnar,

This solution worked perfectly us. Thanks a million!
Previous Topic:p2 incorrectly deletes my plugin
Next Topic:No automatic bundle activation
Goto Forum:
  


Current Time: Thu Apr 25 08:52:48 GMT 2024

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

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

Back to the top