Building a Http Service with the Whiteboard pattern in Apache Karaf
The Whiteboard pattern is a much easier approach to registering servlets, resources, JSPs, or filters. With the Whiteboard extender, the registration of services works in the opposite way to the last recipe. The bundle activator doesn't wait for the Http Service to show up; it just registers the servlets and the other resources as services while the Whiteboard extender picks up those services and makes sure that everything is ready to be served. With the Whiteboard feature, it is possible to use all web technologies available to the underlying Jetty server, as we are not bound to the restricted Http Service interface anymore. This recipe will guide you through this by using two different technologies; first, the standard way, which is via a bundle activator, and second, via Blueprint.
How to do it…
The first step is registering a servlet as a service. First, register your servlet via the activator using the bundle context...