Introduced configuration properties for ALPN/NPN advertised protocols.
No more need to copy protonego-alpn.xml to a jetty.base to specify which protocols are advertised. Instead, simply specify: protonego.protocols=h2-14,http/1.1 protonego.defaultProtocol=http/1.1 in start.ini (in the example above for http2).
This commit is contained in:
parent
d26a003d4c
commit
d2fa4dca60
|
@ -15,9 +15,12 @@
|
|||
<Call name="addConnectionFactory">
|
||||
<Arg>
|
||||
<New id="protonego" class="org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory">
|
||||
<Arg name="protocols">
|
||||
<Array type="String"></Array>
|
||||
<Arg type="String">
|
||||
<Property name="protonego.protocols" default="http/1.1" />
|
||||
</Arg>
|
||||
<Set name="defaultProtocol">
|
||||
<Property name="protonego.defaultProtocol" default="http/1.1" />
|
||||
</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
|
|
@ -34,9 +34,9 @@ public class ALPNServerConnectionFactory extends NegotiatingServerConnectionFact
|
|||
{
|
||||
private static final Logger LOG = Log.getLogger(ALPNServerConnectionFactory.class);
|
||||
|
||||
public ALPNServerConnectionFactory()
|
||||
public ALPNServerConnectionFactory(String protocols)
|
||||
{
|
||||
this(new String[]{});
|
||||
this(protocols.split(","));
|
||||
}
|
||||
|
||||
public ALPNServerConnectionFactory(@Name("protocols") String... protocols)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# SSL Protonegotiate module
|
||||
# SSL Protocol Negotiatiation Module
|
||||
#
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -14,3 +14,8 @@ etc/jetty-http2.xml
|
|||
[ini-template]
|
||||
## HTTP2 Configuration
|
||||
|
||||
# Advertised protocols
|
||||
protonego.protocols=h2-14,http/1.1
|
||||
protonego.defaultProtocol=http/1.1
|
||||
|
||||
# http2.maxConcurrentStreams=1024
|
||||
|
|
|
@ -16,18 +16,17 @@
|
|||
<Call name="addConnectionFactory">
|
||||
<Arg>
|
||||
<New id="protonego" class="org.eclipse.jetty.npn.server.NPNServerConnectionFactory">
|
||||
<Arg name="protocols">
|
||||
<Array type="String">
|
||||
</Array>
|
||||
<Arg type="String">
|
||||
<Property name="protonego.protocols" default="http/1.1" />
|
||||
</Arg>
|
||||
<Set name="defaultProtocol">
|
||||
<Property name="protonego.defaultProtocol" default="http/1.1" />
|
||||
</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Enables NPN debugging on System.err -->
|
||||
<!-- ===========================================================
|
||||
<Set class="org.eclipse.jetty.npn.NextProtoNego" name="debug" type="boolean">true</Set>
|
||||
-->
|
||||
<!-- Enables NPN debugging on System.err -->
|
||||
<!--<Set class="org.eclipse.jetty.npn.NextProtoNego" name="debug" type="boolean">true</Set>-->
|
||||
|
||||
</Configure>
|
||||
|
|
|
@ -34,9 +34,9 @@ public class NPNServerConnectionFactory extends NegotiatingServerConnectionFacto
|
|||
{
|
||||
private static final Logger LOG = Log.getLogger(NPNServerConnectionFactory.class);
|
||||
|
||||
public NPNServerConnectionFactory()
|
||||
public NPNServerConnectionFactory(String protocols)
|
||||
{
|
||||
this(new String[]{});
|
||||
this(protocols.split(","));
|
||||
}
|
||||
|
||||
public NPNServerConnectionFactory(@Name("protocols") String... protocols)
|
||||
|
|
|
@ -19,10 +19,8 @@
|
|||
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;
|
||||
|
@ -60,7 +58,10 @@ public abstract class NegotiatingServerConnectionFactory extends AbstractConnect
|
|||
public NegotiatingServerConnectionFactory(String protocol, String... protocols)
|
||||
{
|
||||
super(protocol);
|
||||
this.protocols = new ArrayList<String>(Arrays.asList(protocols));
|
||||
this.protocols = new ArrayList<>();
|
||||
// Trim the values, as they may come from XML configuration.
|
||||
for (String p : protocols)
|
||||
this.protocols.add(p.trim());
|
||||
}
|
||||
|
||||
public String getDefaultProtocol()
|
||||
|
@ -70,7 +71,8 @@ public abstract class NegotiatingServerConnectionFactory extends AbstractConnect
|
|||
|
||||
public void setDefaultProtocol(String defaultProtocol)
|
||||
{
|
||||
this.defaultProtocol = defaultProtocol;
|
||||
// Trim the value, as it may come from XML configuration.
|
||||
this.defaultProtocol = defaultProtocol.trim();
|
||||
}
|
||||
|
||||
public List<String> getProtocols()
|
||||
|
@ -78,11 +80,6 @@ public abstract class NegotiatingServerConnectionFactory extends AbstractConnect
|
|||
return protocols;
|
||||
}
|
||||
|
||||
public void adProtocol(String protocol)
|
||||
{
|
||||
protocols.add(protocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection newConnection(Connector connector, EndPoint endPoint)
|
||||
{
|
||||
|
|
|
@ -15,5 +15,8 @@ etc/jetty-spdy.xml
|
|||
[ini-template]
|
||||
## SPDY Configuration
|
||||
|
||||
# Initial Window Size for SPDY
|
||||
#spdy.initialWindowSize=65536
|
||||
# Advertised protocols
|
||||
protonego.protocols=spdy/3,http/1.1
|
||||
protonego.defaultProtocol=http/1.1
|
||||
|
||||
# spdy.initialWindowSize=65536
|
||||
|
|
Loading…
Reference in New Issue