Starting with Pax-Web 2.1 it’s possible to bind web applications to a specific http-connector. For this to work you need to configure an additional http connector through jetty.xml. The jetty.xml for pax-web uses a slightly different way of configuring connectors. Instead of setting a new Connector the jetty.xml is interpreted after the Jetty Server has already been configured. Therefore you need to add a connector, not create a new one.
<Call name="addConnector"> <Arg> <New class="org.eclipse.jetty.server.nio.SelectChannelConnector"> <Set name="host"><Property name="jetty.host" /></Set> <Set name="port"><Property name="jetty.port" default="8282"/></Set> <Set name="maxIdleTime">300000</Set> <Set name="Acceptors">2</Set> <Set name="statsOn">false</Set> <Set name="confidentialPort">8443</Set> <Set name="name">jettyConn1</Set> <Set name="lowResourcesConnections">20000</Set> <Set name="lowResourcesMaxIdleTime">5000</Set> </New> </Arg> </Call>
Make sure you have a name configured for this connector. The sample uses jettyConn1 as name.
The Manifest of this Web-Application Bundle needs two additional entries. Web-Connectors and Web-VirtualHosts.
Web-Connectors: jettyConn1 Web-VirtualHosts: localhost
Another alternative way of binding your Web-Application to a certain Web-Connector or Virtual host is to add it to the installation URL.
webbundle:mvn:groupId/artifactId/version/war?Web-ContextPath=test&Web-Connectors=jettyConn1&Web-VirtualHosts=localhost
The Pax-Web itests do contain two working examples for more details check the two links below:
JettyConfigurationExtendedIntegrationTest
JettyConfigurationExtendedTwoIntegrationTest
Schreibe einen Kommentar