Moved NPN[Client|Server]Connection[Factory] classes to their own
modules, akin for the ALPN classes, and refactored all code that was referencing them.
This commit is contained in:
parent
a500701bda
commit
7613385578
|
@ -18,14 +18,14 @@
|
|||
|
||||
package org.eclipse.jetty.embedded;
|
||||
|
||||
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.server.SslConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.SPDYServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
@ -72,8 +72,8 @@ public class SpdyConnector
|
|||
new HTTPSPDYServerConnectionFactory(3,https_config,new ReferrerPushStrategy());
|
||||
|
||||
// NPN Factory
|
||||
SPDYServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
NPNServerConnectionFactory npn =
|
||||
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
NPNServerConnectionFactory npn =
|
||||
new NPNServerConnectionFactory(spdy3.getProtocol(),spdy2.getProtocol(),http.getDefaultProtocol());
|
||||
npn.setDefaultProtocol(http.getDefaultProtocol());
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.lang.management.ManagementFactory;
|
|||
import org.eclipse.jetty.deploy.DeploymentManager;
|
||||
import org.eclipse.jetty.deploy.providers.WebAppProvider;
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
import org.eclipse.jetty.server.AsyncNCSARequestLog;
|
||||
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
|
||||
|
@ -30,6 +31,7 @@ import org.eclipse.jetty.server.Handler;
|
|||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.NCSARequestLog;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
|
@ -39,8 +41,6 @@ import org.eclipse.jetty.server.handler.DefaultHandler;
|
|||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.RequestLogHandler;
|
||||
import org.eclipse.jetty.server.handler.StatisticsHandler;
|
||||
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.SPDYServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.http.PushStrategy;
|
||||
import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy;
|
||||
|
@ -110,7 +110,7 @@ public class SpdyServer
|
|||
// Spdy Connector
|
||||
|
||||
// Make sure that the required NPN implementations are available.
|
||||
SPDYServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
|
||||
// A ReferrerPushStrategy is being initialized.
|
||||
// See: http://www.eclipse.org/jetty/documentation/current/spdy-configuring-push.html for more details.
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-alpn-client</artifactId>
|
||||
<name>Jetty :: ALPN Client</name>
|
||||
<description>Jetty ALPN client services</description>
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<name>Jetty :: ALPN :: Client</name>
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.alpn.client</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-alpn-server</artifactId>
|
||||
<name>Jetty :: ALPN Server</name>
|
||||
<description>Jetty ALPN server services</description>
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<name>Jetty :: ALPN :: Server</name>
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.alpn.server</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
<artifactId>jetty-alpn-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>Jetty :: ALPN :: Parent</name>
|
||||
<description>Jetty ALPN services parent</description>
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<modules>
|
||||
<module>jetty-alpn-server</module>
|
||||
<module>jetty-alpn-client</module>
|
||||
|
|
|
@ -813,6 +813,11 @@
|
|||
<artifactId>jetty-alpn-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-npn-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.example-async-rest</groupId>
|
||||
<artifactId>example-async-rest-webapp</artifactId>
|
||||
|
|
|
@ -54,11 +54,6 @@
|
|||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlet</artifactId>
|
||||
|
@ -66,15 +61,20 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.spdy</groupId>
|
||||
<artifactId>spdy-server</artifactId>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-alpn-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.npn</groupId>
|
||||
<artifactId>npn-api</artifactId>
|
||||
<version>${npn.api.version}</version>
|
||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||
<artifactId>alpn-api</artifactId>
|
||||
<version>${alpn.api.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.eclipse.jetty.http2.server;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
|
@ -29,14 +28,11 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http2.generator.Generator;
|
||||
import org.eclipse.jetty.http2.hpack.HpackContext;
|
||||
import org.eclipse.jetty.http2.hpack.HpackDecoder;
|
||||
import org.eclipse.jetty.http2.hpack.HpackEncoder;
|
||||
import org.eclipse.jetty.io.MappedByteBufferPool;
|
||||
import org.eclipse.jetty.npn.NextProtoNego;
|
||||
import org.eclipse.jetty.alpn.ALPN;
|
||||
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
|
@ -44,8 +40,6 @@ import org.eclipse.jetty.server.SslConnectionFactory;
|
|||
import org.eclipse.jetty.servlet.DefaultServlet;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.SPDYServerConnectionFactory;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
|
||||
|
@ -92,21 +86,21 @@ public class Http2Server
|
|||
// HTTP2 factory
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
|
||||
|
||||
SPDYServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
NPNServerConnectionFactory npn =
|
||||
new NPNServerConnectionFactory(h2.getProtocol(),http.getDefaultProtocol());
|
||||
npn.setDefaultProtocol(http.getDefaultProtocol());
|
||||
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
ALPNServerConnectionFactory alpn =
|
||||
new ALPNServerConnectionFactory(h2.getProtocol(),http.getDefaultProtocol());
|
||||
alpn.setDefaultProtocol(http.getDefaultProtocol());
|
||||
|
||||
// SSL Factory
|
||||
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,npn.getProtocol());
|
||||
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,alpn.getProtocol());
|
||||
|
||||
// SPDY Connector
|
||||
ServerConnector http2Connector =
|
||||
new ServerConnector(server,ssl,npn,h2,new HttpConnectionFactory(https_config));
|
||||
new ServerConnector(server,ssl,alpn,h2,new HttpConnectionFactory(https_config));
|
||||
http2Connector.setPort(8443);
|
||||
server.addConnector(http2Connector);
|
||||
|
||||
NextProtoNego.debug=true;
|
||||
ALPN.debug=true;
|
||||
|
||||
server.start();
|
||||
server.dumpStdErr();
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-npn-parent</artifactId>
|
||||
<version>10.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-npn-client</artifactId>
|
||||
<name>Jetty :: NPN :: Client</name>
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.npn.client</bundle-symbolic-name>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Import-Package>org.eclipse.jetty.npn;resolution:=optional</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- always include the sources to be able to prepare the eclipse-jetty-SDK feature
|
||||
with a snapshot. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<onlyAnalyze>org.eclipse.jetty.npn.*</onlyAnalyze>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-io</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.npn</groupId>
|
||||
<artifactId>npn-api</artifactId>
|
||||
<version>${npn.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -16,7 +16,7 @@
|
|||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.spdy.client;
|
||||
package org.eclipse.jetty.npn.client;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
|
@ -16,7 +16,7 @@
|
|||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.spdy.client;
|
||||
package org.eclipse.jetty.npn.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
|
@ -0,0 +1,92 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-npn-parent</artifactId>
|
||||
<version>10.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-npn-server</artifactId>
|
||||
<name>Jetty :: NPN :: Server</name>
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.npn.server</bundle-symbolic-name>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Import-Package>org.eclipse.jetty.npn,*</Import-Package>
|
||||
<_nouses>true</_nouses>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>config</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- always include the sources to be able to prepare the eclipse-jetty-SDK feature
|
||||
with a snapshot. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<onlyAnalyze>org.eclipse.jetty.npn.*</onlyAnalyze>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.npn</groupId>
|
||||
<artifactId>npn-api</artifactId>
|
||||
<version>${npn.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,21 @@
|
|||
<?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>
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Enables NPN debugging on System.err -->
|
||||
<!-- ===========================================================
|
||||
<Set class="org.eclipse.jetty.npn.NextProtoNego" name="debug" type="boolean">true</Set>
|
||||
-->
|
||||
|
||||
</Configure>
|
|
@ -23,6 +23,10 @@ protonego-impl
|
|||
[depend]
|
||||
protonego-impl/npn-${java.version}
|
||||
|
||||
[lib]
|
||||
lib/jetty-npn-client-${jetty.version}.jar
|
||||
lib/jetty-npn-server-${jetty.version}.jar
|
||||
|
||||
[xml]
|
||||
etc/protonego-npn.xml
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.spdy.server;
|
||||
package org.eclipse.jetty.npn.server;
|
||||
|
||||
import java.util.List;
|
||||
import javax.net.ssl.SSLEngine;
|
|
@ -16,7 +16,7 @@
|
|||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.spdy.server;
|
||||
package org.eclipse.jetty.npn.server;
|
||||
|
||||
import java.util.List;
|
||||
import javax.net.ssl.SSLEngine;
|
|
@ -0,0 +1,15 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-project</artifactId>
|
||||
<version>10.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-npn-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>Jetty :: NPN :: Parent</name>
|
||||
<modules>
|
||||
<module>jetty-npn-server</module>
|
||||
<module>jetty-npn-client</module>
|
||||
</modules>
|
||||
</project>
|
|
@ -27,11 +27,31 @@ import org.eclipse.jetty.io.AbstractConnection;
|
|||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.ssl.SslConnection;
|
||||
import org.eclipse.jetty.server.AbstractConnectionFactory;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
|
||||
public abstract class NegotiatingServerConnectionFactory extends AbstractConnectionFactory
|
||||
{
|
||||
public static void checkProtocolNegotiationAvailable()
|
||||
{
|
||||
if (!isAvailableInBootClassPath("org.eclipse.jetty.alpn.ALPN") &&
|
||||
!isAvailableInBootClassPath("org.eclipse.jetty.npn.NextProtoNego"))
|
||||
throw new IllegalStateException("No ALPN nor NPN classes available");
|
||||
}
|
||||
|
||||
private static boolean isAvailableInBootClassPath(String className)
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<?> klass = ClassLoader.getSystemClassLoader().loadClass(className);
|
||||
if (klass.getClassLoader() != null)
|
||||
throw new IllegalStateException(className + " must be on JVM boot classpath");
|
||||
return true;
|
||||
}
|
||||
catch (ClassNotFoundException x)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private final List<String> protocols;
|
||||
private String defaultProtocol;
|
||||
|
||||
|
|
|
@ -49,6 +49,11 @@
|
|||
<artifactId>jetty-alpn-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-npn-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||
<artifactId>alpn-api</artifactId>
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.eclipse.jetty.io.NegotiatingClientConnectionFactory;
|
|||
import org.eclipse.jetty.io.SelectChannelEndPoint;
|
||||
import org.eclipse.jetty.io.SelectorManager;
|
||||
import org.eclipse.jetty.io.ssl.SslClientConnectionFactory;
|
||||
import org.eclipse.jetty.npn.client.NPNClientConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.FlowControlStrategy;
|
||||
import org.eclipse.jetty.spdy.api.GoAwayInfo;
|
||||
import org.eclipse.jetty.spdy.api.Session;
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
|
||||
<!-- NPN Connection factory with HTTP as default protocol -->
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.spdy.server.NPNServerConnectionFactory">
|
||||
<New class="org.eclipse.jetty.npn.server.NPNServerConnectionFactory">
|
||||
<Arg name="protocols">
|
||||
<Array type="String">
|
||||
<Item>spdy/3</Item>
|
||||
|
|
|
@ -86,6 +86,12 @@
|
|||
<artifactId>jetty-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-npn-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlet</artifactId>
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<?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.spdy.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>
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Enables NPN debugging on System.err -->
|
||||
<!-- ===========================================================
|
||||
<Set class="org.eclipse.jetty.npn.NextProtoNego" name="debug" type="boolean">true</Set>
|
||||
-->
|
||||
|
||||
</Configure>
|
|
@ -21,6 +21,7 @@ package org.eclipse.jetty.spdy.server.http;
|
|||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.AbstractConnectionFactory;
|
||||
import org.eclipse.jetty.server.ConnectionFactory;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
|
@ -28,7 +29,6 @@ import org.eclipse.jetty.server.HttpConnectionFactory;
|
|||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.spdy.api.SPDY;
|
||||
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
public class HTTPSPDYServerConnector extends ServerConnector
|
||||
|
|
|
@ -21,12 +21,12 @@ package org.eclipse.jetty.spdy.server.proxy;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.spdy.api.SPDY;
|
||||
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.SPDYServerConnectionFactory;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
|
|
|
@ -18,10 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.spdy.server.http;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.core.IsEqual.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.InetSocketAddress;
|
||||
|
@ -31,12 +27,12 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.ConnectionFactory;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
|
@ -57,7 +53,6 @@ import org.eclipse.jetty.spdy.api.StreamFrameListener;
|
|||
import org.eclipse.jetty.spdy.api.StreamStatus;
|
||||
import org.eclipse.jetty.spdy.api.SynInfo;
|
||||
import org.eclipse.jetty.spdy.http.HTTPSPDYHeader;
|
||||
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.Fields;
|
||||
import org.eclipse.jetty.util.Promise;
|
||||
|
@ -68,6 +63,10 @@ import org.junit.Assert;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.core.IsEqual.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(ReferrerPushStrategyTest.class);
|
||||
|
|
|
@ -52,6 +52,12 @@
|
|||
<version>${npn.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-npn-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-start</artifactId>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package org.eclipse.jetty.spdy.server.proxy;
|
||||
|
||||
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
|
||||
|
||||
public class NPNProxySPDYToHTTPLoadTest extends ProxySPDYToHTTPLoadTest
|
||||
{
|
||||
|
|
|
@ -55,6 +55,11 @@
|
|||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-npn-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.npn</groupId>
|
||||
<artifactId>npn-api</artifactId>
|
||||
|
|
|
@ -47,37 +47,6 @@ import org.eclipse.jetty.util.annotation.ManagedObject;
|
|||
@ManagedObject("SPDY Server Connection Factory")
|
||||
public class SPDYServerConnectionFactory extends AbstractConnectionFactory
|
||||
{
|
||||
/**
|
||||
* @deprecated use {@link #checkProtocolNegotiationAvailable()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void checkNPNAvailable()
|
||||
{
|
||||
checkProtocolNegotiationAvailable();
|
||||
}
|
||||
|
||||
public static void checkProtocolNegotiationAvailable()
|
||||
{
|
||||
if (!isAvailableInBootClassPath("org.eclipse.jetty.alpn.ALPN") &&
|
||||
!isAvailableInBootClassPath("org.eclipse.jetty.npn.NextProtoNego"))
|
||||
throw new IllegalStateException("No ALPN nor NPN classes available");
|
||||
}
|
||||
|
||||
private static boolean isAvailableInBootClassPath(String className)
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<?> klass = ClassLoader.getSystemClassLoader().loadClass(className);
|
||||
if (klass.getClassLoader() != null)
|
||||
throw new IllegalStateException(className + " must be on JVM boot classpath");
|
||||
return true;
|
||||
}
|
||||
catch (ClassNotFoundException x)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private final Queue<Session> sessions = new ConcurrentLinkedQueue<>();
|
||||
private final short version;
|
||||
private final ServerSessionFrameListener listener;
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.spdy.server;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.eclipse.jetty.spdy.server;
|
|||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.ConnectionFactory;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
|
|
7
pom.xml
7
pom.xml
|
@ -456,10 +456,11 @@
|
|||
<module>jetty-http-spi</module>
|
||||
<module>jetty-osgi</module>
|
||||
<module>jetty-alpn</module>
|
||||
<module>jetty-npn</module>
|
||||
|
||||
<!-- modules that need fixed and added back, or simply dropped and not maintained
|
||||
<module>jetty-rhttp</module>
|
||||
-->
|
||||
<!-- modules that need fixed and added back, or simply dropped and not maintained
|
||||
<module>jetty-rhttp</module>
|
||||
-->
|
||||
<!--<module>jetty-overlay-deployer</module>-->
|
||||
</modules>
|
||||
<dependencyManagement>
|
||||
|
|
|
@ -21,10 +21,12 @@ package org.eclipse.jetty;
|
|||
import java.lang.management.ManagementFactory;
|
||||
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
|
@ -32,8 +34,6 @@ import org.eclipse.jetty.server.SslConnectionFactory;
|
|||
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.DefaultHandler;
|
||||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.SPDYServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory;
|
||||
import org.eclipse.jetty.spdy.server.http.PushStrategy;
|
||||
import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy;
|
||||
|
@ -102,7 +102,7 @@ public class TestTransparentProxyServer
|
|||
|
||||
|
||||
// Spdy Connector
|
||||
SPDYServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
PushStrategy push = new ReferrerPushStrategy();
|
||||
HTTPSPDYServerConnectionFactory spdy2 = new HTTPSPDYServerConnectionFactory(2,config,push);
|
||||
spdy2.setInputBufferSize(8192);
|
||||
|
|
Loading…
Reference in New Issue