Book Image

APACHE KARAF COOKBOOK

Book Image

APACHE KARAF COOKBOOK

Overview of this book

Table of Contents (17 chapters)
Apache Karaf Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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…

  1. The first step is registering a servlet as a service. First, register your servlet via the activator using the bundle context...