Building an application with custom HttpContext with Apache Karaf

All previous recipes have covered how to register servlets and filters, and all from within the same bundle bound to a default HttpContext. If no other HttpContext is defined, DefaultHttpContext is created while registering a servlet or resource. With this recipe, we will work with a custom HttpContext.

Getting ready

As this recipe is a specialization of the previous recipes, you'll find the source code for it in the Building a Http Service with the Whiteboard pattern in Apache Karaf recipe. As usual, the recipe demands the successful installation of the http-whiteboard feature; how this can be achieved is explained in the Installing extended Http Service in Apache Karaf recipe. The ...

Get Apache Karaf Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.