update OSGi for ssl home and base
This commit is contained in:
parent
98b654ba20
commit
f81bb4c000
|
@ -30,6 +30,7 @@ public class OSGiServerConstants
|
|||
* configuration.
|
||||
*/
|
||||
public static final String JETTY_HOME = "jetty.home";
|
||||
public static final String JETTY_BASE = "jetty.base";
|
||||
|
||||
/**
|
||||
* System property to point to a bundle that embeds a jetty configuration
|
||||
|
@ -54,7 +55,7 @@ public class OSGiServerConstants
|
|||
* Usual system property used as the port for https for a typical jetty
|
||||
* configuration.
|
||||
*/
|
||||
public static final String JETTY_PORT_SSL = "jetty.port.ssl";
|
||||
public static final String JETTY_PORT_SSL = "ssl.port";
|
||||
|
||||
|
||||
//for managed jetty instances, name of the configuration parameters
|
||||
|
|
|
@ -154,22 +154,29 @@ public class DefaultJettyAtJettyHomeHelper
|
|||
List<URL> configURLs = jettyHomeDir != null ? getJettyConfigurationURLs(jettyHomeDir) : getJettyConfigurationURLs(jettyHomeBundle, properties);
|
||||
|
||||
LOG.info("Configuring the default jetty server with {}",configURLs);
|
||||
LOG.info("JETTY.HOME="+properties.get(OSGiServerConstants.JETTY_HOME));
|
||||
String home=properties.get(OSGiServerConstants.JETTY_HOME);
|
||||
String base=properties.get(OSGiServerConstants.JETTY_BASE);
|
||||
LOG.info("JETTY.HOME="+home);
|
||||
LOG.info("JETTY.BASE="+base);
|
||||
ClassLoader contextCl = Thread.currentThread().getContextClassLoader();
|
||||
try
|
||||
{
|
||||
Thread.currentThread().setContextClassLoader(JettyBootstrapActivator.class.getClassLoader());
|
||||
|
||||
//ensure jetty.base is set
|
||||
if (base==null)
|
||||
base=home;
|
||||
|
||||
// these properties usually are the ones passed to this type of
|
||||
// configuration.
|
||||
properties.put(OSGiServerConstants.MANAGED_JETTY_SERVER_NAME, OSGiServerConstants.MANAGED_JETTY_SERVER_DEFAULT_NAME);
|
||||
Util.setProperty(properties, OSGiServerConstants.JETTY_HOST, System.getProperty(OSGiServerConstants.JETTY_HOST));
|
||||
Util.setProperty(properties, OSGiServerConstants.JETTY_PORT, System.getProperty(OSGiServerConstants.JETTY_PORT));
|
||||
Util.setProperty(properties, OSGiServerConstants.JETTY_PORT_SSL, System.getProperty(OSGiServerConstants.JETTY_PORT_SSL));
|
||||
|
||||
Util.setProperty(properties, OSGiServerConstants.JETTY_HOME, home);
|
||||
Util.setProperty(properties, OSGiServerConstants.JETTY_BASE, base);
|
||||
Server server = ServerInstanceWrapper.configure(null, configURLs, properties);
|
||||
//ensure jetty.home is set
|
||||
server.setAttribute(OSGiServerConstants.JETTY_HOME, properties.get(OSGiServerConstants.JETTY_HOME));
|
||||
|
||||
|
||||
//Register the default Server instance as an OSGi service.
|
||||
//The JettyServerServiceTracker will notice it and set it up to deploy bundles as wars etc
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
|
||||
|
||||
<!-- ============================================================= -->
|
||||
<!-- Configure the Jetty Server instance with an ID "Server" -->
|
||||
<!-- by adding a HTTP connector. -->
|
||||
<!-- This configuration must be used in conjunction with jetty.xml -->
|
||||
<!-- ============================================================= -->
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Add a HTTP Connector. -->
|
||||
<!-- Configure an o.e.j.server.ServerConnector with a single -->
|
||||
<!-- HttpConnectionFactory instance using the common httpConfig -->
|
||||
<!-- instance defined in jetty.xml -->
|
||||
<!-- -->
|
||||
<!-- Consult the javadoc of o.e.j.server.ServerConnector and -->
|
||||
<!-- o.e.j.server.HttpConnectionFactory for all configuration -->
|
||||
<!-- that may be set here. -->
|
||||
<!-- =========================================================== -->
|
||||
<Call name="addConnector">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.ServerConnector">
|
||||
<Arg name="server"><Ref refid="Server" /></Arg>
|
||||
<Arg name="factories">
|
||||
<Array type="org.eclipse.jetty.server.ConnectionFactory">
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
|
||||
<Arg name="config"><Ref refid="httpConfig" /></Arg>
|
||||
</New>
|
||||
</Item>
|
||||
</Array>
|
||||
</Arg>
|
||||
<Set name="host"><Property name="jetty.host" /></Set>
|
||||
<Set name="port"><Property name="jetty.port" default="80" /></Set>
|
||||
<Set name="idleTimeout"><Property name="http.timeout" default="30000"/></Set>
|
||||
<Set name="soLingerTime"><Property name="http.soLingerTime" default="-1"/></Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
||||
</Configure>
|
|
@ -6,42 +6,23 @@
|
|||
<!-- This configuration must be used in conjunction with jetty.xml -->
|
||||
<!-- and jetty-ssl.xml. -->
|
||||
<!-- ============================================================= -->
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
<Configure id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Add a HTTPS Connector. -->
|
||||
<!-- Configure an o.e.j.server.ServerConnector with connection -->
|
||||
<!-- factories for TLS (aka SSL) and HTTP to provide HTTPS. -->
|
||||
<!-- All accepted TLS connections are wired to a HTTP connection.-->
|
||||
<!-- -->
|
||||
<!-- Consult the javadoc of o.e.j.server.ServerConnector, -->
|
||||
<!-- o.e.j.server.SslConnectionFactory and -->
|
||||
<!-- o.e.j.server.HttpConnectionFactory for all configuration -->
|
||||
<!-- that may be set here. -->
|
||||
<!-- =========================================================== -->
|
||||
<Call id="httpsConnector" name="addConnector">
|
||||
<Call name="addIfAbsentConnectionFactory">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.ServerConnector">
|
||||
<Arg name="server"><Ref refid="Server" /></Arg>
|
||||
<Arg name="factories">
|
||||
<Array type="org.eclipse.jetty.server.ConnectionFactory">
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.server.SslConnectionFactory">
|
||||
<Arg name="next">http/1.1</Arg>
|
||||
<Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
|
||||
</New>
|
||||
</Item>
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
|
||||
<Arg name="config"><Ref refid="sslHttpConfig"/></Arg>
|
||||
</New>
|
||||
</Item>
|
||||
</Array>
|
||||
</Arg>
|
||||
<Set name="host"><Property name="jetty.host" /></Set>
|
||||
<Set name="port"><Property name="jetty.https.port" default="8443" /></Set>
|
||||
<Set name="idleTimeout">30000</Set>
|
||||
</New>
|
||||
<New class="org.eclipse.jetty.server.SslConnectionFactory">
|
||||
<Arg name="next">http/1.1</Arg>
|
||||
<Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
||||
<Call name="addConnectionFactory">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
|
||||
<Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
||||
</Configure>
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
|
||||
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Add connector -->
|
||||
<!-- =========================================================== -->
|
||||
|
||||
<Call name="addConnector">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.ServerConnector">
|
||||
<Arg><Ref refid="Server" /></Arg>
|
||||
<Arg name="factories">
|
||||
<Array type="org.eclipse.jetty.server.ConnectionFactory">
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
|
||||
<Arg name="config"><Ref refid="httpConfig" /></Arg>
|
||||
</New>
|
||||
</Item>
|
||||
</Array>
|
||||
</Arg>
|
||||
<Set name="host"><Property name="jetty.host" /></Set>
|
||||
<Set name="port"><Property name="jetty.port" default="8080"/></Set>
|
||||
<Set name="idleTimeout">300000</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
||||
</Configure>
|
|
@ -1,115 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
|
||||
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
<!-- ============================================================= -->
|
||||
<!-- Configure a SPDY on the ssl connector. -->
|
||||
<!-- ============================================================= -->
|
||||
<Configure id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Create a push strategy which can be used by reference by -->
|
||||
<!-- individual connection factories below. -->
|
||||
<!-- -->
|
||||
<!-- Consult the javadoc of o.e.j.spdy.server.http.ReferrerPushStrategy -->
|
||||
<!-- for all configuration that may be set here. -->
|
||||
<!-- =========================================================== -->
|
||||
<New id="pushStrategy" class="org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy">
|
||||
<!-- Uncomment to blacklist browsers for this push strategy. If one of the blacklisted Strings occurs in the
|
||||
user-agent header sent by the client, push will be disabled for this browser. This is case insensitive" -->
|
||||
<!--
|
||||
<Set name="UserAgentBlacklist">
|
||||
<Array type="String">
|
||||
<Item>.*(?i)firefox/14.*</Item>
|
||||
<Item>.*(?i)firefox/15.*</Item>
|
||||
<Item>.*(?i)firefox/16.*</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
-->
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Add HTTP Customizer for Secure request -->
|
||||
<!-- =========================================================== -->
|
||||
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
|
||||
<Set name="secureScheme">https</Set>
|
||||
<Set name="securePort">
|
||||
<SystemProperty name="jetty.spdy.port" default="8443"/>
|
||||
</Set>
|
||||
<Set name="outputBufferSize">32768</Set>
|
||||
<Set name="requestHeaderSize">8192</Set>
|
||||
<Set name="responseHeaderSize">8192</Set>
|
||||
<Call name="addCustomizer">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.SecureRequestCustomizer"/>
|
||||
</Arg>
|
||||
</Call>
|
||||
</New>
|
||||
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Setup a SSL Context factory -->
|
||||
<!-- =========================================================== -->
|
||||
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
|
||||
<Set name="KeyStorePath"><Property name="jetty.home" default="."/>/etc/keystore
|
||||
</Set>
|
||||
<Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
|
||||
<Set name="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
|
||||
<Set name="TrustStorePath"><Property name="jetty.home" default="."/>/etc/keystore
|
||||
</Set>
|
||||
<Set name="TrustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
|
||||
</New>
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Set connectors -->
|
||||
<!-- =========================================================== -->
|
||||
<Call id="sslConnector" name="addConnector">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.ServerConnector">
|
||||
<Arg name="server">
|
||||
<Ref refid="Server"/>
|
||||
</Arg>
|
||||
<Arg name="factories">
|
||||
<Array type="org.eclipse.jetty.server.ConnectionFactory">
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.server.SslConnectionFactory">
|
||||
<Arg name="next">alpn</Arg>
|
||||
<Arg name="sslContextFactory">
|
||||
<Ref refid="sslContextFactory"/>
|
||||
</Arg>
|
||||
</New>
|
||||
</Item>
|
||||
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory">
|
||||
<Arg name="protocols">
|
||||
<Array type="String">
|
||||
<Item>spdy/3</Item>
|
||||
<Item>spdy/2</Item>
|
||||
<Item>http/1.1</Item>
|
||||
</Array>
|
||||
</Arg>
|
||||
<Set name="defaultProtocol">http/1.1</Set>
|
||||
</New>
|
||||
</Item>
|
||||
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory">
|
||||
<Arg name="version" type="int">3</Arg>
|
||||
<Arg name="config">
|
||||
<Ref refid="httpConfig"/>
|
||||
</Arg>
|
||||
<!-- Set the initial window size for this SPDY connector. -->
|
||||
<!-- See: http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3#TOC-2.6.8-WINDOW_UPDATE -->
|
||||
<Set name="initialWindowSize">65536</Set>
|
||||
</New>
|
||||
</Item>
|
||||
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory">
|
||||
<Arg name="version" type="int">2</Arg>
|
||||
<Arg name="config">
|
||||
<Ref refid="httpConfig"/>
|
||||
</Arg>
|
||||
<!-- Set the initial window size for this SPDY connector. -->
|
||||
<!-- See: http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3#TOC-2.6.8-WINDOW_UPDATE -->
|
||||
<Set name="initialWindowSize">65536</Set>
|
||||
</New>
|
||||
</Item>
|
||||
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
|
||||
<Arg name="config">
|
||||
<Ref refid="httpConfig"/>
|
||||
</Arg>
|
||||
</New>
|
||||
</Item>
|
||||
</Array>
|
||||
</Arg>
|
||||
<Set name="host">
|
||||
<Property name="jetty.host"/>
|
||||
</Set>
|
||||
<Set name="port">
|
||||
<SystemProperty name="jetty.spdy.port" default="8443"/>
|
||||
</Set>
|
||||
<Set name="idleTimeout">30000</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
<!-- Uncomment to override default file extensions to push -->
|
||||
<!--
|
||||
<Set name="PushRegexps">
|
||||
<Array type="String">
|
||||
<Item>.*\.css</Item>
|
||||
<Item>.*\.js</Item>
|
||||
<Item>.*\.png</Item>
|
||||
<Item>.*\.jpg</Item>
|
||||
<Item>.*\.gif</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
-->
|
||||
<Set name="referrerPushPeriod">5000</Set>
|
||||
<Set name="maxAssociatedResources">32</Set>
|
||||
</New>
|
||||
|
||||
<!-- SPDY/3 Connection factory -->
|
||||
<Call name="addConnectionFactory">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory">
|
||||
<Arg name="version" type="int">3</Arg>
|
||||
<Arg name="config"><Ref refid="sslHttpConfig"/></Arg>
|
||||
<!-- Set the initial window size for this SPDY connector. -->
|
||||
<!-- See: http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3#TOC-2.6.8-WINDOW_UPDATE -->
|
||||
<Set name="initialWindowSize"><Property name="spdy.initialWindowSize" default="65536"/></Set>
|
||||
<!-- Uncomment to enable ReferrerPushStrategy -->
|
||||
<!--<Arg name="pushStrategy"><Ref refid="pushStrategy"/></Arg>-->
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
||||
</Configure>
|
||||
|
|
|
@ -2,19 +2,45 @@
|
|||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
|
||||
|
||||
<!-- ============================================================= -->
|
||||
<!-- Configure a TLS (SSL) Context Factory -->
|
||||
<!-- This configuration must be used in conjunction with jetty.xml -->
|
||||
<!-- and either jetty-https.xml or jetty-spdy.xml (but not both) -->
|
||||
<!-- Base SSL configuration -->
|
||||
<!-- This configuration needs to be used together with 1 or more -->
|
||||
<!-- of jetty-https.xml, jetty-spdy.xml and/or jetty-http2.xml -->
|
||||
<!-- ============================================================= -->
|
||||
<Configure id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
|
||||
<Set name="KeyStorePath"><Property name="jetty.home" default="." />/<Property name="jetty.keystore" default="etc/keystore"/></Set>
|
||||
<Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"/></Set>
|
||||
<Set name="KeyManagerPassword"><Property name="jetty.keymanager.password" default="OBF:1u2u1wml1z7s1z7a1wnl1u2g"/></Set>
|
||||
<Set name="TrustStorePath"><Property name="jetty.home" default="." />/<Property name="jetty.truststore" default="etc/keystore"/></Set>
|
||||
<Set name="TrustStorePassword"><Property name="jetty.truststore.password" default="OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"/></Set>
|
||||
<Set name="EndpointIdentificationAlgorithm"></Set>
|
||||
<Set name="ExcludeCipherSuites">
|
||||
<Array type="String">
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Add a SSL Connector with no protocol factories -->
|
||||
<!-- =========================================================== -->
|
||||
<Call name="addConnector">
|
||||
<Arg>
|
||||
<New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
|
||||
<Arg name="server"><Ref refid="Server" /></Arg>
|
||||
<Arg name="factories">
|
||||
<Array type="org.eclipse.jetty.server.ConnectionFactory">
|
||||
</Array>
|
||||
</Arg>
|
||||
<Set name="host"><Property name="jetty.host" /></Set>
|
||||
<Set name="port"><Property name="ssl.port" default="443" /></Set>
|
||||
<Set name="idleTimeout"><Property name="ssl.timeout" default="30000"/></Set>
|
||||
<Set name="soLingerTime"><Property name="ssl.soLingerTime" default="-1"/></Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
||||
<!-- ============================================================= -->
|
||||
<!-- Create a TLS (SSL) Context Factory for later reuse -->
|
||||
<!-- ============================================================= -->
|
||||
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
|
||||
<Set name="KeyStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.keystore" default="etc/keystore"/></Set>
|
||||
<Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"/></Set>
|
||||
<Set name="KeyManagerPassword"><Property name="jetty.keymanager.password" default="OBF:1u2u1wml1z7s1z7a1wnl1u2g"/></Set>
|
||||
<Set name="TrustStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.truststore" default="etc/keystore"/></Set>
|
||||
<Set name="TrustStorePassword"><Property name="jetty.truststore.password" default="OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"/></Set>
|
||||
<Set name="EndpointIdentificationAlgorithm"></Set>
|
||||
<Set name="NeedClientAuth"><Property name="jetty.ssl.needClientAuth" default="false"/></Set>
|
||||
<Set name="WantClientAuth"><Property name="jetty.ssl.wantClientAuth" default="false"/></Set>
|
||||
<Set name="ExcludeCipherSuites">
|
||||
<Array type="String">
|
||||
<Item>SSL_RSA_WITH_DES_CBC_SHA</Item>
|
||||
<Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item>
|
||||
<Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item>
|
||||
|
@ -22,9 +48,10 @@
|
|||
<Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
|
||||
<Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
|
||||
<Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
|
||||
</Array>
|
||||
</Set>
|
||||
</New>
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Create a TLS specific HttpConfiguration based on the -->
|
||||
<!-- common HttpConfiguration defined in jetty.xml -->
|
||||
|
|
|
@ -70,7 +70,7 @@ public class TestJettyOSGiBootContextAsService
|
|||
{
|
||||
ArrayList<Option> options = new ArrayList<Option>();
|
||||
options.add(CoreOptions.junitBundles());
|
||||
options.addAll(configureJettyHomeAndPort("jetty-selector.xml"));
|
||||
options.addAll(configureJettyHomeAndPort("jetty-http.xml"));
|
||||
options.add(CoreOptions.bootDelegationPackages("org.xml.sax", "org.xml.*", "org.w3c.*", "javax.xml.*"));
|
||||
options.addAll(TestJettyOSGiBootCore.coreJettyDependencies());
|
||||
|
||||
|
@ -99,7 +99,8 @@ public class TestJettyOSGiBootContextAsService
|
|||
+ "/jetty-deployer.xml;"
|
||||
+ etc
|
||||
+ "/jetty-testrealm.xml"));
|
||||
options.add(systemProperty("jetty.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_JETTY_HTTP_PORT)));
|
||||
options.add(systemProperty("jetty.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_HTTP_PORT)));
|
||||
options.add(systemProperty("ssl.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_SSL_PORT)));
|
||||
options.add(systemProperty("jetty.home").value(etcFolder.getParentFile().getAbsolutePath()));
|
||||
return options;
|
||||
}
|
||||
|
@ -122,7 +123,7 @@ public class TestJettyOSGiBootContextAsService
|
|||
try
|
||||
{
|
||||
client.start();
|
||||
ContentResponse response = client.GET("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_JETTY_HTTP_PORT + "/acme/index.html");
|
||||
ContentResponse response = client.GET("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_HTTP_PORT + "/acme/index.html");
|
||||
assertEquals(HttpStatus.OK_200, response.getStatus());
|
||||
|
||||
String content = new String(response.getContent());
|
||||
|
|
|
@ -47,7 +47,9 @@ import org.osgi.framework.BundleContext;
|
|||
public class TestJettyOSGiBootCore
|
||||
{
|
||||
private static final String LOG_LEVEL = "WARN";
|
||||
public static int DEFAULT_JETTY_HTTP_PORT = 9876;
|
||||
|
||||
public static final int DEFAULT_HTTP_PORT = 9876;
|
||||
public static final int DEFAULT_SSL_PORT = 9877;
|
||||
|
||||
@Inject
|
||||
private BundleContext bundleContext;
|
||||
|
@ -71,7 +73,8 @@ public class TestJettyOSGiBootCore
|
|||
{
|
||||
List<Option> res = new ArrayList<Option>();
|
||||
// get the jetty home config from the osgi boot bundle.
|
||||
res.add(CoreOptions.systemProperty("jetty.port").value(String.valueOf(DEFAULT_JETTY_HTTP_PORT)));
|
||||
res.add(CoreOptions.systemProperty("jetty.port").value(String.valueOf(DEFAULT_HTTP_PORT)));
|
||||
res.add(CoreOptions.systemProperty("ssl.port").value(String.valueOf(DEFAULT_SSL_PORT)));
|
||||
res.add(CoreOptions.systemProperty("jetty.home.bundle").value("org.eclipse.jetty.osgi.boot"));
|
||||
res.addAll(coreJettyDependencies());
|
||||
return res;
|
||||
|
@ -147,6 +150,6 @@ public class TestJettyOSGiBootCore
|
|||
@Test
|
||||
public void testHttpService() throws Exception
|
||||
{
|
||||
TestOSGiUtil.testHttpServiceGreetings(bundleContext, "http", DEFAULT_JETTY_HTTP_PORT);
|
||||
TestOSGiUtil.testHttpServiceGreetings(bundleContext, "http", DEFAULT_HTTP_PORT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
|
|||
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
|
||||
import static org.ops4j.pax.exam.CoreOptions.options;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -48,10 +47,7 @@ import org.osgi.framework.BundleContext;
|
|||
public class TestJettyOSGiBootSpdy
|
||||
{
|
||||
private static final String LOG_LEVEL = "WARN";
|
||||
|
||||
private static final String JETTY_SPDY_PORT = "jetty.spdy.port";
|
||||
|
||||
private static final int DEFAULT_JETTY_SPDY_PORT = 9877;
|
||||
|
||||
@Inject
|
||||
private BundleContext bundleContext;
|
||||
|
@ -74,7 +70,8 @@ public class TestJettyOSGiBootSpdy
|
|||
public static List<Option> spdyJettyDependencies()
|
||||
{
|
||||
List<Option> res = new ArrayList<Option>();
|
||||
res.add(CoreOptions.systemProperty(JETTY_SPDY_PORT).value(String.valueOf(DEFAULT_JETTY_SPDY_PORT)));
|
||||
res.add(CoreOptions.systemProperty("jetty.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_HTTP_PORT)));
|
||||
res.add(CoreOptions.systemProperty("ssl.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_SSL_PORT)));
|
||||
|
||||
String alpnBoot = System.getProperty("mortbay-alpn-boot");
|
||||
if (alpnBoot == null) { throw new IllegalStateException("Define path to alpn boot jar as system property -Dmortbay-alpn-boot"); }
|
||||
|
@ -114,7 +111,7 @@ public class TestJettyOSGiBootSpdy
|
|||
@Test
|
||||
public void testSpdyOnHttpService() throws Exception
|
||||
{
|
||||
TestOSGiUtil.testHttpServiceGreetings(bundleContext, "https", DEFAULT_JETTY_SPDY_PORT);
|
||||
TestOSGiUtil.testHttpServiceGreetings(bundleContext, "https", TestJettyOSGiBootCore.DEFAULT_SSL_PORT);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class TestJettyOSGiBootWebAppAsService
|
|||
{
|
||||
ArrayList<Option> options = new ArrayList<Option>();
|
||||
options.add(CoreOptions.junitBundles());
|
||||
options.addAll(configureJettyHomeAndPort("jetty-selector.xml"));
|
||||
options.addAll(configureJettyHomeAndPort("jetty-http.xml"));
|
||||
options.add(CoreOptions.bootDelegationPackages("org.xml.sax", "org.xml.*", "org.w3c.*", "javax.xml.*"));
|
||||
options.add(CoreOptions.systemPackages("com.sun.org.apache.xalan.internal.res","com.sun.org.apache.xml.internal.utils",
|
||||
"com.sun.org.apache.xml.internal.utils", "com.sun.org.apache.xpath.internal",
|
||||
|
@ -102,7 +102,8 @@ public class TestJettyOSGiBootWebAppAsService
|
|||
+ "/jetty-deployer.xml;"
|
||||
+ etc
|
||||
+ "/jetty-testrealm.xml"));
|
||||
options.add(systemProperty("jetty.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_JETTY_HTTP_PORT)));
|
||||
options.add(systemProperty("jetty.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_HTTP_PORT)));
|
||||
options.add(systemProperty("ssl.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_SSL_PORT)));
|
||||
options.add(systemProperty("jetty.home").value(etcFolder.getParentFile().getAbsolutePath()));
|
||||
return options;
|
||||
}
|
||||
|
@ -144,7 +145,7 @@ public class TestJettyOSGiBootWebAppAsService
|
|||
{
|
||||
client.start();
|
||||
|
||||
ContentResponse response = client.GET("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_JETTY_HTTP_PORT + "/acme/index.html");
|
||||
ContentResponse response = client.GET("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_HTTP_PORT + "/acme/index.html");
|
||||
assertEquals(HttpStatus.OK_200, response.getStatus());
|
||||
|
||||
String content = new String(response.getContent());
|
||||
|
|
|
@ -63,7 +63,7 @@ public class TestJettyOSGiBootWithJsp
|
|||
|
||||
ArrayList<Option> options = new ArrayList<Option>();
|
||||
options.add(CoreOptions.junitBundles());
|
||||
options.addAll(configureJettyHomeAndPort("jetty-selector.xml"));
|
||||
options.addAll(configureJettyHomeAndPort("jetty-http.xml"));
|
||||
options.add(CoreOptions.bootDelegationPackages("org.xml.sax", "org.xml.*", "org.w3c.*", "javax.xml.*", "javax.activation.*"));
|
||||
options.add(CoreOptions.systemPackages("com.sun.org.apache.xalan.internal.res","com.sun.org.apache.xml.internal.utils",
|
||||
"com.sun.org.apache.xml.internal.utils", "com.sun.org.apache.xpath.internal",
|
||||
|
@ -98,8 +98,10 @@ public class TestJettyOSGiBootWithJsp
|
|||
+ "/jetty-testrealm.xml";
|
||||
|
||||
options.add(systemProperty(OSGiServerConstants.MANAGED_JETTY_XML_CONFIG_URLS).value(xmlConfigs));
|
||||
options.add(systemProperty("jetty.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_JETTY_HTTP_PORT)));
|
||||
options.add(systemProperty("jetty.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_HTTP_PORT)));
|
||||
options.add(systemProperty("ssl.port").value(String.valueOf(TestJettyOSGiBootCore.DEFAULT_SSL_PORT)));
|
||||
options.add(systemProperty("jetty.home").value(etcFolder.getParentFile().getAbsolutePath()));
|
||||
options.add(systemProperty("jetty.base").value(etcFolder.getParentFile().getAbsolutePath()));
|
||||
return options;
|
||||
}
|
||||
|
||||
|
@ -135,7 +137,7 @@ public class TestJettyOSGiBootWithJsp
|
|||
@Test
|
||||
public void testHttpService() throws Exception
|
||||
{
|
||||
TestOSGiUtil.testHttpServiceGreetings(bundleContext, "http", TestJettyOSGiBootCore.DEFAULT_JETTY_HTTP_PORT);
|
||||
TestOSGiUtil.testHttpServiceGreetings(bundleContext, "http", TestJettyOSGiBootCore.DEFAULT_HTTP_PORT);
|
||||
}
|
||||
|
||||
|
||||
|
@ -146,7 +148,7 @@ public class TestJettyOSGiBootWithJsp
|
|||
try
|
||||
{
|
||||
client.start();
|
||||
ContentResponse response = client.GET("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_JETTY_HTTP_PORT + "/jsp/dump.jsp");
|
||||
ContentResponse response = client.GET("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_HTTP_PORT + "/jsp/dump.jsp");
|
||||
assertEquals(HttpStatus.OK_200, response.getStatus());
|
||||
|
||||
String content = new String(response.getContent());
|
||||
|
|
Loading…
Reference in New Issue