Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-02-12 23:06:24 -0500
committerGreg Wilkins2015-02-12 23:06:24 -0500
commitc090f179a7c3bab138aa14bf08abaab9e3cd27d3 (patch)
treeffcb792bac8b64362d5c4c6241d4612f4fd76c07
parent4db654ad324873841f808641bb2354b7cc7c8b68 (diff)
downloadorg.eclipse.jetty.project-c090f179a7c3bab138aa14bf08abaab9e3cd27d3.tar.gz
org.eclipse.jetty.project-c090f179a7c3bab138aa14bf08abaab9e3cd27d3.tar.xz
org.eclipse.jetty.project-c090f179a7c3bab138aa14bf08abaab9e3cd27d3.zip
459845 - Support upgrade from http1 to http2/websocket
Added jetty-http2c.xml and http2c.mod
-rw-r--r--jetty-http2/http2-server/src/main/config/etc/jetty-http2c.xml17
-rw-r--r--jetty-http2/http2-server/src/main/config/modules/http2c.mod22
-rw-r--r--jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java2
-rw-r--r--jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2CServerConnectionFactory.java17
-rw-r--r--jetty-server/src/main/config/etc/jetty-http.xml2
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java13
6 files changed, 60 insertions, 13 deletions
diff --git a/jetty-http2/http2-server/src/main/config/etc/jetty-http2c.xml b/jetty-http2/http2-server/src/main/config/etc/jetty-http2c.xml
new file mode 100644
index 0000000000..1077a5c9d2
--- /dev/null
+++ b/jetty-http2/http2-server/src/main/config/etc/jetty-http2c.xml
@@ -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>
+
diff --git a/jetty-http2/http2-server/src/main/config/modules/http2c.mod b/jetty-http2/http2-server/src/main/config/modules/http2c.mod
new file mode 100644
index 0000000000..1073181bb3
--- /dev/null
+++ b/jetty-http2/http2-server/src/main/config/modules/http2c.mod
@@ -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
diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java
index 8696dc7ee7..ac986232f5 100644
--- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java
+++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java
@@ -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;
}
diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2CServerConnectionFactory.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2CServerConnectionFactory.java
index af7365033e..d9667f3034 100644
--- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2CServerConnectionFactory.java
+++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2CServerConnectionFactory.java
@@ -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");
}
diff --git a/jetty-server/src/main/config/etc/jetty-http.xml b/jetty-server/src/main/config/etc/jetty-http.xml
index 8456a14d4b..adeeaae331 100644
--- a/jetty-server/src/main/config/etc/jetty-http.xml
+++ b/jetty-server/src/main/config/etc/jetty-http.xml
@@ -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>
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java
index 577a9f82c9..9926325146 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java
@@ -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)
{

Back to the top