Book Image

Apache Karaf Cookbook

By : Jamie Goodyear, Johan Edstorm, Achim Nierbeck, Heath J Kesler
Book Image

Apache Karaf Cookbook

By: Jamie Goodyear, Johan Edstorm, Achim Nierbeck, Heath J Kesler

Overview of this book

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

Binding a web project to a specific host in Apache Karaf


With Karaf 3 and Pax Web 3, it is possible to bind a web application to a specific HTTP connector. This is a feasible solution to separate internal and external applications on the same server.

Getting ready

The sample code for this recipe is available at https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter4/chapter4-recipe8. Here, you will find a jetty.xml file at the src/main/etc location. It can be used to add an extra connector. Two extra recipes are available to show how to use this with a standard WAB file or the Whiteboard extender.

How to do it…

First of all, the server needs to be configured to support different HTTP connectors. Therefore, it is necessary to configure the Jetty server by editing the jetty.xml file found in the etc folder, as shown in the following code:

<Call name="addConnector">
  <Arg>
    <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
      <Set name="host...