459845 - Support upgrade from http1 to http2/websocket
Added jetty-http2c.xml and http2c.mod
This commit is contained in:
parent
4db654ad32
commit
c090f179a7
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
|
||||
|
||||
<!-- ============================================================= -->
|
||||
<!-- Configure a HTTP2 on the ssl connector. -->
|
||||
<!-- ============================================================= -->
|
||||
<Configure id="httpConnector" class="org.eclipse.jetty.server.ServerConnector">
|
||||
<Call name="addConnectionFactory">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory">
|
||||
<Arg name="config"><Ref refid="httpConfig"/></Arg>
|
||||
<Set name="maxConcurrentStreams"><Property name="http2.maxConcurrentStreams" default="1024"/></Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
</Configure>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#
|
||||
# HTTP2 Clear Text Support Module
|
||||
#
|
||||
|
||||
[depend]
|
||||
http
|
||||
|
||||
[lib]
|
||||
lib/http2/*.jar
|
||||
|
||||
[xml]
|
||||
etc/jetty-http2c.xml
|
||||
|
||||
[ini-template]
|
||||
## HTTP2c Configuration
|
||||
|
||||
# This module adds support for HTTP/2 clear text to the
|
||||
# HTTP/1 clear text connector (defined in jetty-http.xml)
|
||||
# The resulting connector will accept both HTTP/1 and HTTP/2
|
||||
# connections
|
||||
|
||||
# http2.maxConcurrentStreams=1024
|
|
@ -47,6 +47,8 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
|
|||
protected AbstractHTTP2ServerConnectionFactory(@Name("config") HttpConfiguration httpConfiguration,String... protocols)
|
||||
{
|
||||
super(protocols);
|
||||
if (httpConfiguration==null)
|
||||
throw new IllegalArgumentException("Null HttpConfiguration");
|
||||
this.httpConfiguration = httpConfiguration;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,25 @@ import org.eclipse.jetty.http2.parser.ServerParser;
|
|||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.util.annotation.Name;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** HTTP2 Clear Text Connection factory.
|
||||
* <p>This extension of HTTP2ServerConnection Factory sets the
|
||||
* protocol name to "h2c" as used by the clear text upgrade mechanism
|
||||
* for HTTP2 and marks all TLS ciphers as unacceptable.
|
||||
* </p>
|
||||
* <p>If used in combination with a {@link HttpConnectionFactory} as the
|
||||
* default protocol, this factory can support the non-standard direct
|
||||
* update mechanism, where a HTTP1 request of the form "PRI * HTTP/2.0"
|
||||
* is used to trigger a switch to a HTTP2 connection. This approach
|
||||
* allows a single port to accept either HTTP/1 or HTTP/2 direct
|
||||
* connections.
|
||||
*/
|
||||
public class HTTP2CServerConnectionFactory extends HTTP2ServerConnectionFactory
|
||||
{
|
||||
public HTTP2CServerConnectionFactory(HttpConfiguration httpConfiguration)
|
||||
public HTTP2CServerConnectionFactory(@Name("config") HttpConfiguration httpConfiguration)
|
||||
{
|
||||
super(httpConfiguration,"h2c");
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<!-- =========================================================== -->
|
||||
<Call name="addConnector">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.ServerConnector">
|
||||
<New id="httpConnector" class="org.eclipse.jetty.server.ServerConnector">
|
||||
<Arg name="server"><Ref refid="Server" /></Arg>
|
||||
<Arg name="acceptors" type="int"><Property name="http.acceptors" default="-1"/></Arg>
|
||||
<Arg name="selectors" type="int"><Property name="http.selectors" default="-1"/></Arg>
|
||||
|
|
|
@ -41,6 +41,8 @@ public class HttpConnectionFactory extends AbstractConnectionFactory implements
|
|||
{
|
||||
super(HttpVersion.HTTP_1_1.asString());
|
||||
_config=config;
|
||||
if (config==null)
|
||||
throw new IllegalArgumentException("Null HttpConfiguration");
|
||||
addBean(_config);
|
||||
}
|
||||
|
||||
|
@ -50,17 +52,6 @@ public class HttpConnectionFactory extends AbstractConnectionFactory implements
|
|||
return _config;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isDispatchIO()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setDispatchIO(boolean dispatchIO)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection newConnection(Connector connector, EndPoint endPoint)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue