I've managed to embed Jetty in Felix and get it to serve up static content (thanx to some help from the ResourceServlet from PAX WEB). Now I'm onto JSPs. But this is where it's getting pretty tricky.

The only documentation I can find is on the Jetty site, and that details how to embed Jetty in Equinox. I doubt the Jetty team has tested this thoroughly, though. When I try to install the appropriate bundles, I run into numerous problems:

- The ant-1.6.5.jar isn't a valid bundle, and so I had to modify the jsp-2.1.jar to include the ant-1.6.5.jar in the bundle, then add it to the Bundle-Classpath. - The real kicker though is that jsp-2.1.jar depends on package exports from core-3.1.1.jar and core-3.1.1.jar requires equinox bundles. While it has those bundles listed as optionally required, core-3.1.1.jar doesn't resolve properly under felix. Since they were listed as optional, I removed them from the Manifest.mf and repackaged. After that, it resolved fine, but I get an NoClassDefFoundError when starting the bundle, as it can't load the org.eclipse.core.runtime.PlugIn class. I suppose it's the end of the road for hoping to embed Jetty in Felix until I can work with the Jetty team to get this resolved.

Oh, I also had to add the following packages to the configuration, as Jetty was looking for them as well when resolve jsp-api-2.1.jar:
com.sun.org.apache.xalan.internal.res; \
com.sun.org.apache.xml.internal.utils; \
com.sun.org.apache.xpath.internal; \
com.sun.org.apache.xpath.internal.jaxp; \
com.sun.org.apache.xpath.internal.objects; \

--kirk
On Feb 20, 2008, at Feb 20, 10:25 PM, Alin Dreghiciu wrote:

I hope you don't mind asking about your use case? Why don't you use
one of the Http Services that are based on Jetty?
As for deploying static file Jetty has a resource servlet that is used
when nothing else matches a request. The problem with it is that is
quite tight coupled with a web application like structure. In most
simple way you can implement and register a servlet (as you say this
works) that will use the bundle that contains the static resource to
find and return the static file content. Of course you have to get
hold of that bundle and have a mapping mechanism between the request
and the actual file.

You can take a look as it is done on Pax Web:
https://scm.ops4j.org/repos/ops4j/projects/pax/web/service/src/main/java/org/ops4j/pax/web/service/internal/ResourceServlet.java

Alin

On Thu, Feb 21, 2008 at 5:31 AM, Kirk Knoernschild <[EMAIL PROTECTED] > wrote:
I've embedded Jetty in Felix, registered a servlet, and have that
working. But I simply can't seem to figure out how to serve up a
static html file (just a simple hello.html) where that html file is
deployed in one of the bundles. Using the OSGi HttpService made this
incredibly easy, so I can't help but think it's equally as easy with
Jetty. But no luck so far.

Anyone have ideas for me?

thanx.

--kirk
_______________________________________________
OSGi Developer Mail List
[email protected]
https://www2.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
[email protected]
https://www2.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
[email protected]
https://www2.osgi.org/mailman/listinfo/osgi-dev

Reply via email to