diff --git a/jetty-spdy/spdy-example-webapp/pom.xml b/jetty-spdy/spdy-example-webapp/pom.xml index 8a924da08c1..514da4f4127 100644 --- a/jetty-spdy/spdy-example-webapp/pom.xml +++ b/jetty-spdy/spdy-example-webapp/pom.xml @@ -12,24 +12,6 @@ - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - - @@ -69,15 +50,14 @@ quit -Xbootclasspath/p:${settings.localRepository}/org/mortbay/jetty/npn/npn-boot/${npn.version}/npn-boot-${npn.version}.jar - -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 - ${basedir}/src/main/config/etc/jetty-spdy-proxy.xml + ${basedir}/src/main/config/example-jetty-spdy-proxy.xml / org.eclipse.jetty.spdy - spdy-jetty-http + spdy-http-server ${project.version} diff --git a/jetty-spdy/spdy-example-webapp/src/main/config/etc/jetty-spdy-proxy.xml b/jetty-spdy/spdy-example-webapp/src/main/config/example-jetty-spdy-proxy.xml similarity index 63% rename from jetty-spdy/spdy-example-webapp/src/main/config/etc/jetty-spdy-proxy.xml rename to jetty-spdy/spdy-example-webapp/src/main/config/example-jetty-spdy-proxy.xml index 1dbc98a367c..31a85228a51 100644 --- a/jetty-spdy/spdy-example-webapp/src/main/config/etc/jetty-spdy-proxy.xml +++ b/jetty-spdy/spdy-example-webapp/src/main/config/example-jetty-spdy-proxy.xml @@ -1,61 +1,74 @@ - - - - - - - - - - - - - - - - /etc/keystore - OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 - OBF:1u2u1wml1z7s1z7a1wnl1u2g - /etc/keystore - OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 + src/main/resources/keystore.jks + storepwd + src/main/resources/truststore.jks + storepwd + TLSv1 + + + + https + + + + 32768 + 8192 + 8192 + + + + + + + + + + + - + + + - - 3 - - + + 3 + + + + - 9090 - spdy/3 + 9090 @@ -74,7 +87,9 @@ spdy/3 - + + + @@ -101,7 +116,7 @@ --> - + @@ -114,7 +129,7 @@ - + diff --git a/jetty-spdy/spdy-example-webapp/src/main/config/example-jetty-spdy.xml b/jetty-spdy/spdy-example-webapp/src/main/config/example-jetty-spdy.xml new file mode 100644 index 00000000000..d8988bbe9d3 --- /dev/null +++ b/jetty-spdy/spdy-example-webapp/src/main/config/example-jetty-spdy.xml @@ -0,0 +1,138 @@ + + + + + + + src/main/resources/keystore.jks + storepwd + src/main/resources/truststore.jks + storepwd + TLSv1 + + + + + + https + + + + 32768 + 8192 + 8192 + + + + + + + + + + + + + + + + + + 5000 + 32 + + + + + + + + + + + + + npn + + + + + + + + + + + + spdy/3 + spdy/2 + http/1.1 + + + http/1.1 + + + + + + + 3 + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + + + + + 8443 + + + + + diff --git a/jetty-spdy/spdy-example-webapp/src/main/webapp/WEB-INF/web.xml b/jetty-spdy/spdy-example-webapp/src/main/webapp/WEB-INF/web.xml index e1f0eaeb86a..eb49319a3e4 100644 --- a/jetty-spdy/spdy-example-webapp/src/main/webapp/WEB-INF/web.xml +++ b/jetty-spdy/spdy-example-webapp/src/main/webapp/WEB-INF/web.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> diff --git a/jetty-spdy/spdy-http-server/pom.xml b/jetty-spdy/spdy-http-server/pom.xml index 02ddc012038..57a917bb10f 100644 --- a/jetty-spdy/spdy-http-server/pom.xml +++ b/jetty-spdy/spdy-http-server/pom.xml @@ -15,6 +15,23 @@ + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + + config + + + + + maven-dependency-plugin diff --git a/jetty-spdy/spdy-http-server/src/main/config/etc/jetty-spdy-proxy.xml b/jetty-spdy/spdy-http-server/src/main/config/etc/jetty-spdy-proxy.xml new file mode 100644 index 00000000000..3b374d79158 --- /dev/null +++ b/jetty-spdy/spdy-http-server/src/main/config/etc/jetty-spdy-proxy.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + /etc/keystore + OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 + OBF:1u2u1wml1z7s1z7a1wnl1u2g + /etc/keystore + OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + + + + + + + + 9090 + + + + + + + + + + + + + + + + + + + + + + + + + + + + spdy/3 + + + + + + + + localhost + + + spdy/3 + 127.0.0.1 + 9090 + + + + + + + + + + + + + + + + + + + + + + + + + 8080 + + + + + + + + + + + + + + + + 8443 + + + + + diff --git a/jetty-spdy/spdy-example-webapp/src/main/config/etc/jetty-spdy.xml b/jetty-spdy/spdy-http-server/src/main/config/etc/jetty-spdy.xml similarity index 96% rename from jetty-spdy/spdy-example-webapp/src/main/config/etc/jetty-spdy.xml rename to jetty-spdy/spdy-http-server/src/main/config/etc/jetty-spdy.xml index 9d858ca55ae..57f232d9731 100644 --- a/jetty-spdy/spdy-example-webapp/src/main/config/etc/jetty-spdy.xml +++ b/jetty-spdy/spdy-http-server/src/main/config/etc/jetty-spdy.xml @@ -26,6 +26,12 @@ OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 + + + + diff --git a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/http/HTTPSPDYServerConnector.java b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/http/HTTPSPDYServerConnector.java index 13eae62679f..b76ac4e9c7e 100644 --- a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/http/HTTPSPDYServerConnector.java +++ b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/http/HTTPSPDYServerConnector.java @@ -16,7 +16,6 @@ // ======================================================================== // - package org.eclipse.jetty.spdy.server.http; import java.util.Collections; @@ -51,29 +50,28 @@ public class HTTPSPDYServerConnector extends ServerConnector public HTTPSPDYServerConnector(Server server, SslContextFactory sslContextFactory, Map pushStrategies) { - this(server,new HttpConfiguration(),sslContextFactory,pushStrategies); + this(server, new HttpConfiguration(), sslContextFactory, pushStrategies); } public HTTPSPDYServerConnector(Server server, short version, HttpConfiguration httpConfiguration, PushStrategy push) { - super(server,new HTTPSPDYServerConnectionFactory(version,httpConfiguration,push)); - + super(server, new HTTPSPDYServerConnectionFactory(version, httpConfiguration, push)); } public HTTPSPDYServerConnector(Server server, HttpConfiguration config, SslContextFactory sslContextFactory, Map pushStrategies) { - super(server,AbstractConnectionFactory.getFactories(sslContextFactory, - sslContextFactory==null - ?new ConnectionFactory[] {new HttpConnectionFactory(config)} - :new ConnectionFactory[] {new NPNServerConnectionFactory("spdy/3","spdy/2","http/1.1"), - new HttpConnectionFactory(config), - new HTTPSPDYServerConnectionFactory(SPDY.V3,new HttpConfiguration(),getPushStrategy(SPDY.V3, pushStrategies)), - new HTTPSPDYServerConnectionFactory(SPDY.V2,new HttpConfiguration(),getPushStrategy(SPDY.V2, pushStrategies))})); - if (getConnectionFactory(NPNServerConnectionFactory.class)!=null) - getConnectionFactory(NPNServerConnectionFactory.class).setDefaultProtocol("http/1.1"); + super(server, AbstractConnectionFactory.getFactories(sslContextFactory, + sslContextFactory == null + ? new ConnectionFactory[]{new HttpConnectionFactory(config)} + : new ConnectionFactory[]{new NPNServerConnectionFactory("spdy/3", "spdy/2", "http/1.1"), + new HttpConnectionFactory(config), + new HTTPSPDYServerConnectionFactory(SPDY.V3, config, getPushStrategy(SPDY.V3, pushStrategies)), + new HTTPSPDYServerConnectionFactory(SPDY.V2, config, getPushStrategy(SPDY.V2, pushStrategies))})); + NPNServerConnectionFactory npnConnectionFactory = getConnectionFactory(NPNServerConnectionFactory.class); + if (npnConnectionFactory != null) + npnConnectionFactory.setDefaultProtocol("http/1.1"); } - private static PushStrategy getPushStrategy(short version, Map pushStrategies) { PushStrategy pushStrategy = pushStrategies.get(version); diff --git a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPSPDYProxyConnector.java b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPSPDYProxyConnector.java deleted file mode 100644 index e8fd31d05ee..00000000000 --- a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPSPDYProxyConnector.java +++ /dev/null @@ -1,40 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - - -package org.eclipse.jetty.spdy.server.proxy; - -import org.eclipse.jetty.server.HttpConfiguration; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.spdy.api.SPDY; -import org.eclipse.jetty.spdy.server.SPDYServerConnector; -import org.eclipse.jetty.util.ssl.SslContextFactory; - -public class HTTPSPDYProxyConnector extends SPDYServerConnector -{ - public HTTPSPDYProxyConnector(Server server, ProxyEngineSelector proxyEngineSelector) - { - this(server, null, proxyEngineSelector); - } - - public HTTPSPDYProxyConnector(Server server, SslContextFactory sslContextFactory, ProxyEngineSelector proxyEngineSelector) - { - super(server, sslContextFactory, proxyEngineSelector); - addConnectionFactory(new ProxyHTTPConnectionFactory(new HttpConfiguration(), SPDY.V2, proxyEngineSelector)); - } -} diff --git a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPSPDYProxyServerConnector.java b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPSPDYProxyServerConnector.java new file mode 100644 index 00000000000..3913438705e --- /dev/null +++ b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPSPDYProxyServerConnector.java @@ -0,0 +1,62 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package org.eclipse.jetty.spdy.server.proxy; + +import org.eclipse.jetty.server.ConnectionFactory; +import org.eclipse.jetty.server.HttpConfiguration; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.spdy.api.SPDY; +import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory; +import org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory; +import org.eclipse.jetty.util.ssl.SslContextFactory; + +public class HTTPSPDYProxyServerConnector extends ServerConnector +{ + public HTTPSPDYProxyServerConnector(Server server, ProxyEngineSelector proxyEngineSelector) + { + this(server, new HttpConfiguration(), proxyEngineSelector); + } + + public HTTPSPDYProxyServerConnector(Server server, HttpConfiguration config, ProxyEngineSelector proxyEngineSelector) + { + this(server, null, config, proxyEngineSelector); + } + + public HTTPSPDYProxyServerConnector(Server server, SslContextFactory sslContextFactory, ProxyEngineSelector proxyEngineSelector) + { + this(server, sslContextFactory, new HttpConfiguration(), proxyEngineSelector); + } + + public HTTPSPDYProxyServerConnector(Server server, SslContextFactory sslContextFactory, HttpConfiguration config, ProxyEngineSelector proxyEngineSelector) + { + super(server, + sslContextFactory, + sslContextFactory == null + ? new ConnectionFactory[]{new ProxyHTTPConnectionFactory(config, SPDY.V2, proxyEngineSelector)} + : new ConnectionFactory[]{new NPNServerConnectionFactory("spdy/3", "spdy/2", "http/1.1"), + new HTTPSPDYServerConnectionFactory(SPDY.V3, config), + new HTTPSPDYServerConnectionFactory(SPDY.V2, config), + new ProxyHTTPConnectionFactory(config, SPDY.V2, proxyEngineSelector)}); + NPNServerConnectionFactory npnConnectionFactory = getConnectionFactory(NPNServerConnectionFactory.class); + if (npnConnectionFactory != null) + npnConnectionFactory.setDefaultProtocol("http/1.1"); + } +} diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPSPDYTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPSPDYTest.java index 69f52ec0f0b..ef463681f2d 100644 --- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPSPDYTest.java +++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPSPDYTest.java @@ -31,6 +31,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.spdy.api.BytesDataInfo; import org.eclipse.jetty.spdy.api.DataInfo; import org.eclipse.jetty.spdy.api.GoAwayInfo; @@ -90,7 +91,7 @@ public class ProxyHTTPSPDYTest private SPDYClient.Factory factory; private Server server; private Server proxy; - private SPDYServerConnector proxyConnector; + private ServerConnector proxyConnector; public ProxyHTTPSPDYTest(short version) { @@ -115,7 +116,7 @@ public class ProxyHTTPSPDYTest SPDYProxyEngine spdyProxyEngine = new SPDYProxyEngine(factory); proxyEngineSelector.putProxyEngine("spdy/" + version, spdyProxyEngine); proxyEngineSelector.putProxyServerInfo("localhost", new ProxyEngineSelector.ProxyServerInfo("spdy/" + version, address.getHostName(), address.getPort())); - proxyConnector = new HTTPSPDYProxyConnector(server, proxyEngineSelector); + proxyConnector = new HTTPSPDYProxyServerConnector(server, proxyEngineSelector); proxyConnector.setPort(0); proxy.addConnector(proxyConnector); proxy.start();