diff options
author | Greg Wilkins | 2014-08-07 02:58:12 +0000 |
---|---|---|
committer | Greg Wilkins | 2014-08-07 02:58:12 +0000 |
commit | 287e86b7aa787c9836fccbe2816dd08b4b6c599e (patch) | |
tree | ef28d4c5fdd2452201c851711db8a6336a2b06a4 | |
parent | a4d4b3ab571fa56b02d611f2b565d03ccccb1347 (diff) | |
download | org.eclipse.jetty.project-287e86b7aa787c9836fccbe2816dd08b4b6c599e.tar.gz org.eclipse.jetty.project-287e86b7aa787c9836fccbe2816dd08b4b6c599e.tar.xz org.eclipse.jetty.project-287e86b7aa787c9836fccbe2816dd08b4b6c599e.zip |
decomposed https,http2 and spdy modules to share ServerConnector
20 files changed, 249 insertions, 304 deletions
diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/etc/protonego-alpn.xml b/jetty-alpn/jetty-alpn-server/src/main/config/etc/protonego-alpn.xml index 3c1ed6daac..657f8836e3 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/config/etc/protonego-alpn.xml +++ b/jetty-alpn/jetty-alpn-server/src/main/config/etc/protonego-alpn.xml @@ -1,19 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> -<Configure id="protonego" 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> +<Configure id="sslConnector" class="org.eclipse.jetty.server.ServerConnector"> - <Set name="defaultProtocol">http/1.1</Set> + <Call name="addConnectionFactory"> + <Arg> + <New class="org.eclipse.jetty.server.SslConnectionFactory"> + <Arg name="next"><Property name="protonego"/></Arg> + <Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg> + </New> + </Arg> + </Call> + + <Call name="addConnectionFactory"> + <Arg> + <New id="protonego" class="org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory"> + <Arg name="protocols"> + <Array type="String"></Array> + </Arg> + </New> + </Arg> + </Call> - <!-- Enables ALPN debugging on System.err --> - <!--<Set class="org.eclipse.jetty.alpn.ALPN" name="debug" type="boolean">true</Set>--> + <!-- Enables ALPN debugging on System.err --> + <!--<Set class="org.eclipse.jetty.alpn.ALPN" name="debug" type="boolean">true</Set>--> </Configure> diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn.mod index 0e399f05cb..ca51179c26 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn.mod +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/protonego-impl/alpn.mod @@ -27,9 +27,6 @@ protonego-impl/alpn-${java.version} lib/jetty-alpn-client-${jetty.version}.jar lib/jetty-alpn-server-${jetty.version}.jar -[xml] -etc/protonego-alpn.xml - [files] lib/ lib/alpn/ diff --git a/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnectionFactory.java b/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnectionFactory.java index a6e386b7bd..3a0e50853a 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnectionFactory.java +++ b/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnectionFactory.java @@ -34,6 +34,11 @@ public class ALPNServerConnectionFactory extends NegotiatingServerConnectionFact { private static final Logger LOG = Log.getLogger(ALPNServerConnectionFactory.class); + public ALPNServerConnectionFactory() + { + this(new String[]{}); + } + public ALPNServerConnectionFactory(@Name("protocols") String... protocols) { super("alpn", protocols); diff --git a/jetty-distribution/src/main/resources/modules/ssl-protonego.mod b/jetty-distribution/src/main/resources/modules/ssl-protonego.mod new file mode 100644 index 0000000000..4a348a6829 --- /dev/null +++ b/jetty-distribution/src/main/resources/modules/ssl-protonego.mod @@ -0,0 +1,11 @@ +# +# SSL Protonegotiate module +# + +[depend] +ssl +protonego + +[xml] +etc/protonego-${protonego}.xml + diff --git a/jetty-http2/http2-server/src/main/config/etc/jetty-http2.xml b/jetty-http2/http2-server/src/main/config/etc/jetty-http2.xml index 038f3d1371..b0ad6581e1 100644 --- a/jetty-http2/http2-server/src/main/config/etc/jetty-http2.xml +++ b/jetty-http2/http2-server/src/main/config/etc/jetty-http2.xml @@ -2,60 +2,16 @@ <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> <!-- ============================================================= --> -<!-- Configure a HTTP2 connector. --> +<!-- Configure a HTTP2 on the ssl connector. --> <!-- ============================================================= --> -<Configure id="Server" class="org.eclipse.jetty.server.Server"> - - <Call id="http2Connector" 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"> - - <!-- SSL Connection factory with 'protonego' as next protocol --> - <Item> - <New class="org.eclipse.jetty.server.SslConnectionFactory"> - <Arg name="next"><Property name="protonego"/></Arg> - <Arg name="sslContextFactory"> - <Ref refid="sslContextFactory"/> - </Arg> - </New> - </Item> - - <!-- Next Protocol Connection factory with HTTP/1.1 as default protocol --> - <Item> - <Ref refid="protonego"/> - </Item> - - <!-- HTTP/2 Connection factory --> - <Item> - <New class="org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory"> - <Arg name="config"> - <Ref refid="sslHttpConfig"/> - </Arg> - <Set name="maxConcurrentStreams"><Property name="http2.maxConcurrentStreams" default="1024"/></Set> - </New> - </Item> - - <!-- HTTP/1.1 Connection factory --> - <Item> - <New class="org.eclipse.jetty.server.HttpConnectionFactory"> - <Arg name="config"> - <Ref refid="sslHttpConfig"/> - </Arg> - </New> - </Item> - </Array> - </Arg> - - <Set name="host"><Property name="http2.host"/></Set> - <Set name="port"><Property name="http2.port" default="443"/></Set> - <Set name="idleTimeout"><Property name="http2.timeout" default="30000"/></Set> - </New> - </Arg> - </Call> - +<Configure id="sslConnector" class="org.eclipse.jetty.server.ServerConnector"> + <Call name="addConnectionFactory"> + <Arg> + <New class="org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory"> + <Arg name="config"><Ref refid="sslHttpConfig"/></Arg> + <Set name="maxConcurrentStreams"><Property name="http2.maxConcurrentStreams" default="1024"/></Set> + </New> + </Arg> + </Call> </Configure> + diff --git a/jetty-http2/http2-server/src/main/config/modules/http2.mod b/jetty-http2/http2-server/src/main/config/modules/http2.mod index b0d4bc8910..f1a43941a9 100644 --- a/jetty-http2/http2-server/src/main/config/modules/http2.mod +++ b/jetty-http2/http2-server/src/main/config/modules/http2.mod @@ -3,8 +3,7 @@ # [depend] -ssl -protonego +ssl-protonego [lib] lib/http2/*.jar @@ -15,8 +14,3 @@ etc/jetty-http2.xml [ini-template] ## HTTP2 Configuration -# Port for HTTP2 connections -http2.port=8443 - -# HTTP2 idle timeout in milliseconds -http2.timeout=30000 diff --git a/jetty-npn/jetty-npn-server/src/main/config/etc/protonego-npn.xml b/jetty-npn/jetty-npn-server/src/main/config/etc/protonego-npn.xml index 743a5ecd6f..2a24f6ca2d 100644 --- a/jetty-npn/jetty-npn-server/src/main/config/etc/protonego-npn.xml +++ b/jetty-npn/jetty-npn-server/src/main/config/etc/protonego-npn.xml @@ -1,16 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> -<Configure id="protonego" class="org.eclipse.jetty.npn.server.NPNServerConnectionFactory"> - <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> + +<Configure id="sslConnector" class="org.eclipse.jetty.server.ServerConnector"> + + <Call name="addConnectionFactory"> + <Arg> + <New class="org.eclipse.jetty.server.SslConnectionFactory"> + <Arg name="next"><Property name="protonego"/></Arg> + <Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg> + </New> + </Arg> + </Call> + + <Call name="addConnectionFactory"> + <Arg> + <New id="protonego" class="org.eclipse.jetty.npn.server.NPNServerConnectionFactory"> + <Arg name="protocols"> + <Array type="String"> + </Array> + </Arg> + </New> + </Arg> + </Call> <!-- =========================================================== --> <!-- Enables NPN debugging on System.err --> diff --git a/jetty-npn/jetty-npn-server/src/main/config/modules/protonego-impl/npn.mod b/jetty-npn/jetty-npn-server/src/main/config/modules/protonego-impl/npn.mod index f9d02061fb..a1bbc46ee4 100644 --- a/jetty-npn/jetty-npn-server/src/main/config/modules/protonego-impl/npn.mod +++ b/jetty-npn/jetty-npn-server/src/main/config/modules/protonego-impl/npn.mod @@ -27,9 +27,6 @@ protonego-impl/npn-${java.version} lib/jetty-npn-client-${jetty.version}.jar lib/jetty-npn-server-${jetty.version}.jar -[xml] -etc/protonego-npn.xml - [files] lib/ lib/npn/ diff --git a/jetty-npn/jetty-npn-server/src/main/java/org/eclipse/jetty/npn/server/NPNServerConnectionFactory.java b/jetty-npn/jetty-npn-server/src/main/java/org/eclipse/jetty/npn/server/NPNServerConnectionFactory.java index 8c1cb190c5..39da0c404c 100644 --- a/jetty-npn/jetty-npn-server/src/main/java/org/eclipse/jetty/npn/server/NPNServerConnectionFactory.java +++ b/jetty-npn/jetty-npn-server/src/main/java/org/eclipse/jetty/npn/server/NPNServerConnectionFactory.java @@ -34,6 +34,11 @@ public class NPNServerConnectionFactory extends NegotiatingServerConnectionFacto { private static final Logger LOG = Log.getLogger(NPNServerConnectionFactory.class); + public NPNServerConnectionFactory() + { + this(new String[]{}); + } + public NPNServerConnectionFactory(@Name("protocols") String... protocols) { super("npn", protocols); diff --git a/jetty-server/src/main/config/etc/jetty-https.xml b/jetty-server/src/main/config/etc/jetty-https.xml index 419f8d19ee..f27cec070b 100644 --- a/jetty-server/src/main/config/etc/jetty-https.xml +++ b/jetty-server/src/main/config/etc/jetty-https.xml @@ -6,43 +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="https.port" default="443" /></Set> - <Set name="idleTimeout"><Property name="https.timeout" default="30000"/></Set> - <Set name="soLingerTime"><Property name="https.soLingerTime" default="-1"/></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> diff --git a/jetty-server/src/main/config/etc/jetty-ssl.xml b/jetty-server/src/main/config/etc/jetty-ssl.xml index 4ac2d3e240..1014c8507a 100644 --- a/jetty-server/src/main/config/etc/jetty-ssl.xml +++ b/jetty-server/src/main/config/etc/jetty-ssl.xml @@ -2,21 +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.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"> +<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> @@ -24,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 --> diff --git a/jetty-server/src/main/config/modules/https.mod b/jetty-server/src/main/config/modules/https.mod index bd1b718081..d576c56258 100644 --- a/jetty-server/src/main/config/modules/https.mod +++ b/jetty-server/src/main/config/modules/https.mod @@ -10,10 +10,4 @@ etc/jetty-https.xml [ini-template] ## HTTPS Configuration -# HTTP port to listen on -https.port=8443 -# HTTPS idle timeout in milliseconds -https.timeout=30000 -# HTTPS Socket.soLingerTime in seconds. (-1 to disable) -# https.soLingerTime=-1 diff --git a/jetty-server/src/main/config/modules/ssl.mod b/jetty-server/src/main/config/modules/ssl.mod index 449f58104f..fa3229e245 100644 --- a/jetty-server/src/main/config/modules/ssl.mod +++ b/jetty-server/src/main/config/modules/ssl.mod @@ -16,6 +16,13 @@ http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/ # define the port to use for secure redirection jetty.secure.port=8443 +# SSL port to listen on +ssl.port=8443 +# SSL idle timeout in milliseconds +ssl.timeout=30000 +# HTTPS Socket.soLingerTime in seconds. (-1 to disable) +# ssl.soLingerTime=-1 + # Setup a demonstration keystore and truststore jetty.keystore=etc/keystore jetty.truststore=etc/keystore diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java index 027f5a2607..89d22129cc 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java @@ -337,7 +337,7 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co { synchronized (_factories) { - return _factories.get(protocol.toLowerCase(Locale.ENGLISH)); + return _factories.get(protocol); } } @@ -357,13 +357,20 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co { synchronized (_factories) { - ConnectionFactory old=_factories.remove(factory.getProtocol()); + String key=factory.getProtocol(); + ConnectionFactory old=_factories.remove(key); if (old!=null) + { + if (old.getProtocol().equals(_defaultProtocol)) + _defaultProtocol=null; removeBean(old); - _factories.put(factory.getProtocol().toLowerCase(Locale.ENGLISH), factory); + LOG.info("{} removed {}",this,old); + } + _factories.put(key, factory); addBean(factory); if (_defaultProtocol==null) _defaultProtocol=factory.getProtocol(); + LOG.info("{} added {}",this,factory); } } @@ -371,12 +378,17 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co { synchronized (_factories) { - if (_factories.containsKey(factory.getProtocol())) - return; - _factories.put(factory.getProtocol().toLowerCase(Locale.ENGLISH), factory); - addBean(factory); - if (_defaultProtocol==null) - _defaultProtocol=factory.getProtocol(); + String key=factory.getProtocol(); + if (_factories.containsKey(key)) + LOG.info("{} addIfAbsent ignored {}",this,factory); + else + { + _factories.put(key, factory); + addBean(factory); + if (_defaultProtocol==null) + _defaultProtocol=factory.getProtocol(); + LOG.info("{} addIfAbsent added {}",this,factory); + } } } @@ -384,7 +396,7 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co { synchronized (_factories) { - ConnectionFactory factory= _factories.remove(protocol.toLowerCase(Locale.ENGLISH)); + ConnectionFactory factory= _factories.remove(protocol); removeBean(factory); return factory; } @@ -439,7 +451,7 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co public void setDefaultProtocol(String defaultProtocol) { - _defaultProtocol = defaultProtocol.toLowerCase(Locale.ENGLISH); + _defaultProtocol = defaultProtocol; if (isRunning()) _defaultConnectionFactory=getConnectionFactory(_defaultProtocol); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/NegotiatingServerConnectionFactory.java b/jetty-server/src/main/java/org/eclipse/jetty/server/NegotiatingServerConnectionFactory.java index 08c8817189..2daafb80f4 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/NegotiatingServerConnectionFactory.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/NegotiatingServerConnectionFactory.java @@ -18,9 +18,11 @@ package org.eclipse.jetty.server; +import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; + import javax.net.ssl.SSLEngine; import org.eclipse.jetty.io.AbstractConnection; @@ -58,7 +60,7 @@ public abstract class NegotiatingServerConnectionFactory extends AbstractConnect public NegotiatingServerConnectionFactory(String protocol, String... protocols) { super(protocol); - this.protocols = Arrays.asList(protocols); + this.protocols = new ArrayList<String>(Arrays.asList(protocols)); } public String getDefaultProtocol() @@ -75,6 +77,11 @@ public abstract class NegotiatingServerConnectionFactory extends AbstractConnect { return protocols; } + + public void adProtocol(String protocol) + { + protocols.add(protocol); + } @Override public Connection newConnection(Connector connector, EndPoint endPoint) @@ -87,8 +94,7 @@ public abstract class NegotiatingServerConnectionFactory extends AbstractConnect while (i.hasNext()) { String protocol = i.next(); - String prefix = "ssl-"; - if (protocol.regionMatches(true, 0, prefix, 0, prefix.length()) || protocol.equalsIgnoreCase("alpn")) + if ("SSL".equalsIgnoreCase(protocol) || "alpn".equalsIgnoreCase("protocol")) { i.remove(); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java b/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java index 5fcc1038da..29c06b2717 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java @@ -47,7 +47,7 @@ public class SslConnectionFactory extends AbstractConnectionFactory public SslConnectionFactory(@Name("sslContextFactory") SslContextFactory factory, @Name("next") String nextProtocol) { - super("SSL-"+nextProtocol); + super("SSL"); _sslContextFactory=factory==null?new SslContextFactory():factory; _nextProtocol=nextProtocol; addBean(_sslContextFactory); @@ -97,6 +97,7 @@ public class SslConnectionFactory extends AbstractConnectionFactory @Override public String toString() { - return String.format("%s@%x{%s}",this.getClass().getSimpleName(),hashCode(),getProtocol()); + return String.format("%s@%x{%s->%s}",this.getClass().getSimpleName(),hashCode(),getProtocol(),_nextProtocol); } + } diff --git a/jetty-spdy/spdy-http-server/src/main/config/etc/jetty-spdy.xml b/jetty-spdy/spdy-http-server/src/main/config/etc/jetty-spdy.xml index b094d7ce85..fbaca7d5ef 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/etc/jetty-spdy.xml +++ b/jetty-spdy/spdy-http-server/src/main/config/etc/jetty-spdy.xml @@ -2,138 +2,76 @@ <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> <!-- ============================================================= --> -<!-- Configure a SPDY connector. --> -<!-- This configuration must be used in conjunction with jetty.xml --> -<!-- and jetty-ssl.xml --> +<!-- Configure a SPDY on the ssl connector. --> <!-- ============================================================= --> -<Configure id="Server" class="org.eclipse.jetty.server.Server"> +<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> + --> - <!-- =========================================================== --> - <!-- 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> - --> - - <!-- 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> - - <!-- =========================================================== --> - <!-- Add a SPDY/HTTPS Connector. --> - <!-- Configure an o.e.j.server.ServerConnector with connection --> - <!-- factories for TLS (aka SSL), ProtoNego, SPDY and HTTP to --> - <!-- provide a connector that can accept HTTPS or SPDY --> - <!-- connections. --> - <!-- --> - <!-- All accepted TLS connections are initially wired to a --> - <!-- Protonego connection, which attempts to use a TLS extension --> - <!-- to negotiation the protocol. If it is not supported by --> - <!-- the client, then the connection is replaced by a HTTP --> - <!-- connection. If a specific protocol version (eg spdy/3) is --> - <!-- negotiated, then the appropriate connection factory --> - <!-- is used to create a connection to replace the connection --> - <!-- --> - <!-- The final result is a SPDY or HTTP connection wired behind --> - <!-- a TLS (aka SSL) connection. --> - <!-- --> - <!-- Consult the javadoc of o.e.j.server.ServerConnector and the --> - <!-- specific connection factory types for all configuration --> - <!-- that may be set here. --> - <!-- =========================================================== --> - <Call id="spdyConnector" 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"> - - <!-- SSL Connection factory with Protonego as next protocol --> - <Item> - <New class="org.eclipse.jetty.server.SslConnectionFactory"> - <Arg name="next"><Property name="protonego"/></Arg> - <Arg name="sslContextFactory"> - <Ref refid="sslContextFactory"/> - </Arg> - </New> - </Item> - - <!-- NPN Connection factory with HTTP as default protocol --> - <Item> - <Ref refid="protonego"/> - </Item> - - <!-- SPDY/3 Connection factory --> - <Item> - <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> - </Item> - - <!-- SPDY/2 Connection factory --> - <Item> - <New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory"> - <Arg name="version" type="int">2</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> - </New> - </Item> - - <!-- HTTP Connection factory --> - <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="spdy.port" default="443"/></Set> - <Set name="idleTimeout"><Property name="spdy.timeout" default="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> + <!-- =========================================================== --> + <!-- Add a SPDY/HTTPS Connector factory --> + <!-- =========================================================== --> + + <!-- 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> + + <!-- SPDY/2 Connection factory --> + <Call name="addConnectionFactory"> + <Arg> + <New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory"> + <Arg name="version" type="int">2</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> + </New> + </Arg> + </Call> + </Configure> diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/spdy.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/spdy.mod index cf79dfa0f2..cb4cf971c7 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/spdy.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/spdy.mod @@ -3,8 +3,7 @@ # [depend] -ssl -protonego +ssl-protonego [lib] lib/spdy/*.jar @@ -16,11 +15,5 @@ etc/jetty-spdy.xml [ini-template] ## SPDY Configuration -# Port for SPDY connections -spdy.port=8443 - -# SPDY idle timeout in milliseconds -spdy.timeout=30000 - # Initial Window Size for SPDY #spdy.initialWindowSize=65536 diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java index 804d63ae32..c0570a3604 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Modules.java @@ -313,9 +313,10 @@ public class Modules implements Iterable<Module> if (module.isEnabled()) { // already enabled, skip + module.addSources(sources); return; } - + StartLog.debug("Enabling module: %s (via %s)",module.getName(),Main.join(sources,", ")); module.setEnabled(true); args.parseModule(module); @@ -348,7 +349,7 @@ public class Modules implements Iterable<Module> } if (parent != null) { - enableModule(parent,sources); + enableModule(parent,new ArrayList<String>()); } } } diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java index 4aff293052..06b92461dd 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java @@ -425,6 +425,7 @@ public class StartArgs for (String xmlRef : module.getXmls()) { // Straight Reference + xmlRef=properties.expand(xmlRef); Path xmlfile = baseHome.getPath(xmlRef); addUniqueXmlFile(xmlRef,xmlfile); } |