Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Static content files outside bundle(HTML outside bundle)
Static content files outside bundle [message #926215] Fri, 28 September 2012 12:21 Go to next message
Erwin Karbasi is currently offline Erwin Karbasi
Messages: 2
Registered: September 2012
Junior Member
Hello Experts,

I'd like to add static content (e.g. static HTML files) outside bundles into Equinox platform like adding static contents into HTTP Servers (Web Servers) without needing to package them in any jar file.
I know the following link:http://www.eclipse.org/equinox/server/http_writing_application.php but it doesn't help me because as per description there i have to add my static content into bundle file.

Is there any option for putting static content outside bundle files and access them by URL?

Your direction would be highly appreciated.

Thanks in advance,
Erwin
Re: Static content files outside bundle [message #926229 is a reply to message #926215] Fri, 28 September 2012 12:43 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas Watson
Messages: 436
Registered: July 2009
Senior Member
One way would be to register an HttpServlet with the HttpService directly and pass in your own HttpContext implementation. The HttpContext interface has the following method:

org.osgi.service.http.HttpContext.getResource(String)

You can serve up any content you like using that method. The content could be included in your own bundle or from any other location you like that you can produce a URL for.

HTH

Tom.
Re: Static content files outside bundle [message #926245 is a reply to message #926229] Fri, 28 September 2012 13:07 Go to previous message
Erwin Karbasi is currently offline Erwin Karbasi
Messages: 2
Registered: September 2012
Junior Member
Hello Tom,

Thank you for direction.

Your approach is programmatically.
Is there any declarative approach in Equinox?
Like the following plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
     <extension-point id="servlets" name="HttpService servlets" schema="schema/servlets.exsd"/>
     <extension-point id="resources" name="HttpService resources" schema="schema/resources.exsd"/>
     <extension-point id="httpcontexts" name="HttpService httpcontexts" schema="schema/httpcontexts.exsd"/>
     <extension
           id="helloServlet"
           point="org.eclipse.equinox.http.registry.servlets">
        <servlet
              alias="/decl/helloworld"
              class="com.javaworld.sample.osgi.web.webapp.HelloWorldServlet">
        </servlet>
     </extension>
     <extension
           id="helloResource"
           point="org.eclipse.equinox.http.registry.resources">
        <resource
              alias="/decl/helloworld.html"
              base-name="/helloworld.html"
              />
     </extension>
</plugin>


but the static content would be in any location.

Thanks,
Erwin
Previous Topic:Shared ServletContexts in HTTPService
Next Topic:Loading to many bundles during startup
Goto Forum:
  


Current Time: Thu Oct 23 21:21:05 GMT 2014

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

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