decomposed https,http2 and spdy modules to share ServerConnector
This commit is contained in:
parent
a4d4b3ab57
commit
287e86b7aa
|
@ -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>
|
||||
<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.alpn.server.ALPNServerConnectionFactory">
|
||||
<Arg name="protocols">
|
||||
<Array type="String"></Array>
|
||||
</Arg>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
||||
<Set name="defaultProtocol">http/1.1</Set>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#
|
||||
# SSL Protonegotiate module
|
||||
#
|
||||
|
||||
[depend]
|
||||
ssl
|
||||
protonego
|
||||
|
||||
[xml]
|
||||
etc/protonego-${protonego}.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>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 -->
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 -->
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue