As of release 6.1.5, Jetty ships with jar file manifests that include appropriate OSGi bundle information. This means that you can import the jetty jars into an OSGi framework and use them, for example, to build a HTTP service.
The jetty jars whose manifests include OSGi bundle information are:
Using jetty jars in Equinox
The jetty bundles mostly have dependencies amongst themselves (loosely in the order listed above), although the
jetty-naming.jar and the the jsp jars do have external dependencies.
If you are using Equinox, it is quite easy to resolve these dependencies. Here's an Equinox config.ini file with all the external dependencies already setup up so that they will be loaded at start up time. Assuming you downloaded the config.ini file to
/tmp, here's a quick way to start up Equinox 3.3 with this config.ini file:
If you want to store the config.ini file somewhere else, then you need to include it's location on the command line:
There are more instructions on the Eclipse Equinox website on how to start Equinox.
Now you should be running Equinox, and you should see a prompt like so:
To see the state of all the bundles which are currently enabled, do:
You'll see output something like the following:
You can now go ahead and import the jetty jars. This is a matter of using the
install command to load each of them. Assuming I have jetty 6.1.5 installed in
/home/janb/src/jetty-6.1.5, I install the servlet-api-2.5 jar and check on it's status by doing:
The final step is to
start that jar so that it is available to the OSGi environment:
Rinse and repeat for all the jars we listed at the top of this article and you will have successfully imported the jetty jars into OSGi.