From f81bb4c000a7558ace0b64110e27fbec16de1624 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 14 Aug 2014 11:21:08 +1000 Subject: [PATCH] update OSGi for ssl home and base --- .../jetty/osgi/boot/OSGiServerConstants.java | 3 +- .../DefaultJettyAtJettyHomeHelper.java | 15 +- .../src/test/config/etc/jetty-http.xml | 42 +++++ .../src/test/config/etc/jetty-https.xml | 49 ++---- .../src/test/config/etc/jetty-selector.xml | 31 ---- .../src/test/config/etc/jetty-spdy.xml | 163 ++++++------------ .../src/test/config/etc/jetty-ssl.xml | 57 ++++-- .../TestJettyOSGiBootContextAsService.java | 7 +- .../osgi/test/TestJettyOSGiBootCore.java | 9 +- .../osgi/test/TestJettyOSGiBootSpdy.java | 9 +- .../TestJettyOSGiBootWebAppAsService.java | 7 +- .../osgi/test/TestJettyOSGiBootWithJsp.java | 10 +- 12 files changed, 189 insertions(+), 213 deletions(-) create mode 100644 jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-http.xml delete mode 100644 jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-selector.xml diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiServerConstants.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiServerConstants.java index b16eff92e29..4e6247dc3af 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiServerConstants.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiServerConstants.java @@ -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 diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java index 8f22f9768dd..32e5bf7223b 100644 --- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java +++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java @@ -154,22 +154,29 @@ public class DefaultJettyAtJettyHomeHelper List 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 diff --git a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-http.xml b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-http.xml new file mode 100644 index 00000000000..c3f74f3e668 --- /dev/null +++ b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-http.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-https.xml b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-https.xml index a6bef16ff1e..f27cec070bd 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-https.xml +++ b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-https.xml @@ -6,42 +6,23 @@ - + - - - - - - - - - - - - + - - - - - - - http/1.1 - - - - - - - - - - - - - 30000 - + + http/1.1 + + + + + + + + + + + diff --git a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-selector.xml b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-selector.xml deleted file mode 100644 index 67cd87c2a7e..00000000000 --- a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-selector.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - 300000 - - - - - diff --git a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-spdy.xml b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-spdy.xml index 2bc1fe3cecb..fcb9ce34734 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-spdy.xml +++ b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-spdy.xml @@ -1,115 +1,60 @@ - + + + + + + + + + + + + + + + - - - - - https - - - - 32768 - 8192 - 8192 - - - - - - - - - - - - - /etc/keystore - - OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 - OBF:1u2u1wml1z7s1z7a1wnl1u2g - /etc/keystore - - OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 - - - - - - - - - - - - - - - - alpn - - - - - - - - - - - spdy/3 - spdy/2 - http/1.1 - - - http/1.1 - - - - - - 3 - - - - - - 65536 - - - - - - 2 - - - - - - 65536 - - - - - - - - - - - - - - - - - - - 30000 - - - + + + 5000 + 32 + + + + + + 3 + + + + + + + + + + diff --git a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-ssl.xml b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-ssl.xml index b4c3551aadc..1014c8507a0 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-ssl.xml +++ b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-ssl.xml @@ -2,19 +2,45 @@ - - - + + + - - / - - - / - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + / + + + / + + + + + + SSL_RSA_WITH_DES_CBC_SHA SSL_DHE_RSA_WITH_DES_CBC_SHA SSL_DHE_DSS_WITH_DES_CBC_SHA @@ -22,9 +48,10 @@ SSL_RSA_EXPORT_WITH_DES40_CBC_SHA SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA - - - + + + + diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootContextAsService.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootContextAsService.java index 0dfc1bb0e18..07eff6afd7b 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootContextAsService.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootContextAsService.java @@ -70,7 +70,7 @@ public class TestJettyOSGiBootContextAsService { ArrayList