Http Service implementations

There are quite a few implementations of the OSGi Http Service specification out there. In this chapter, we'll use the one provided by the Felix project. Later, in Chapter 13, Improving the Graphics, we'll also look at the Pax Web implementation as another example.

The Apache Felix Http Service

The Felix project provides a simple, but effective, Http Service implementation. It allows registration of servlets, as well as provides other non-standard features.

The bundles provided are as follows:

  • Apache Felix Http Jetty: Implements the Http Service on Jetty, an embedded Http server
  • Apache Felix Http Whiteboard: Provides an implementation of the whiteboard pattern

Also, for using the host application server in bridged mode (instead of an embedded Jetty), the bundles are:

  • Apache Felix Http Bridge
  • Apache Felix Http Proxy: Is needed inside a WAR that is deployed in bridged mode

The "Apache Felix Http Bundle" bundle provides all of the above in a single bundle.

Note

A servlet bridge allows a standard web application container, such as Apache Tomcat, to delegate HTTP requests to another application (in this case, the OSGi framework). Using a container in bridged mode adds the flexibility of using a stable and well-supported container, instead of an Http Service implementation bundle, while still gaining from the flexibility of the OSGi service platform.

For our project, we will use the implementation with embedded Jetty. This will save us the need to install and configure an external web server. We will also use the whiteboard-based registration right away. Let's install those two bundles now, before going on to implementing the servlet bundle.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.86.211