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:
Simone Bordet 2014-06-16 12:44:12 +02:00
parent a500701bda
commit 7613385578
51 changed files with 307 additions and 115 deletions

View File

@ -18,14 +18,14 @@
package org.eclipse.jetty.embedded; package org.eclipse.jetty.embedded;
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer; import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory; 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.HTTPSPDYServerConnectionFactory;
import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy; import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
@ -72,7 +72,7 @@ public class SpdyConnector
new HTTPSPDYServerConnectionFactory(3,https_config,new ReferrerPushStrategy()); new HTTPSPDYServerConnectionFactory(3,https_config,new ReferrerPushStrategy());
// NPN Factory // NPN Factory
SPDYServerConnectionFactory.checkProtocolNegotiationAvailable(); NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
NPNServerConnectionFactory npn = NPNServerConnectionFactory npn =
new NPNServerConnectionFactory(spdy3.getProtocol(),spdy2.getProtocol(),http.getDefaultProtocol()); new NPNServerConnectionFactory(spdy3.getProtocol(),spdy2.getProtocol(),http.getDefaultProtocol());
npn.setDefaultProtocol(http.getDefaultProtocol()); npn.setDefaultProtocol(http.getDefaultProtocol());

View File

@ -23,6 +23,7 @@ import java.lang.management.ManagementFactory;
import org.eclipse.jetty.deploy.DeploymentManager; import org.eclipse.jetty.deploy.DeploymentManager;
import org.eclipse.jetty.deploy.providers.WebAppProvider; import org.eclipse.jetty.deploy.providers.WebAppProvider;
import org.eclipse.jetty.jmx.MBeanContainer; import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
import org.eclipse.jetty.security.HashLoginService; import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.server.AsyncNCSARequestLog; import org.eclipse.jetty.server.AsyncNCSARequestLog;
import org.eclipse.jetty.server.ForwardedRequestCustomizer; 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.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.NCSARequestLog; import org.eclipse.jetty.server.NCSARequestLog;
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer; import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; 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.HandlerCollection;
import org.eclipse.jetty.server.handler.RequestLogHandler; import org.eclipse.jetty.server.handler.RequestLogHandler;
import org.eclipse.jetty.server.handler.StatisticsHandler; 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.HTTPSPDYServerConnectionFactory;
import org.eclipse.jetty.spdy.server.http.PushStrategy; import org.eclipse.jetty.spdy.server.http.PushStrategy;
import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy; import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy;
@ -110,7 +110,7 @@ public class SpdyServer
// Spdy Connector // Spdy Connector
// Make sure that the required NPN implementations are available. // Make sure that the required NPN implementations are available.
SPDYServerConnectionFactory.checkProtocolNegotiationAvailable(); NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
// A ReferrerPushStrategy is being initialized. // A ReferrerPushStrategy is being initialized.
// See: http://www.eclipse.org/jetty/documentation/current/spdy-configuring-push.html for more details. // See: http://www.eclipse.org/jetty/documentation/current/spdy-configuring-push.html for more details.

View File

@ -6,9 +6,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jetty-alpn-client</artifactId> <artifactId>jetty-alpn-client</artifactId>
<name>Jetty :: ALPN Client</name> <name>Jetty :: ALPN :: Client</name>
<description>Jetty ALPN client services</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.alpn.client</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.alpn.client</bundle-symbolic-name>
</properties> </properties>

View File

@ -6,9 +6,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>jetty-alpn-server</artifactId> <artifactId>jetty-alpn-server</artifactId>
<name>Jetty :: ALPN Server</name> <name>Jetty :: ALPN :: Server</name>
<description>Jetty ALPN server services</description>
<url>http://www.eclipse.org/jetty</url>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.alpn.server</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.alpn.server</bundle-symbolic-name>
</properties> </properties>

View File

@ -8,8 +8,6 @@
<artifactId>jetty-alpn-parent</artifactId> <artifactId>jetty-alpn-parent</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Jetty :: ALPN :: Parent</name> <name>Jetty :: ALPN :: Parent</name>
<description>Jetty ALPN services parent</description>
<url>http://www.eclipse.org/jetty</url>
<modules> <modules>
<module>jetty-alpn-server</module> <module>jetty-alpn-server</module>
<module>jetty-alpn-client</module> <module>jetty-alpn-client</module>

View File

@ -813,6 +813,11 @@
<artifactId>jetty-alpn-server</artifactId> <artifactId>jetty-alpn-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-npn-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.example-async-rest</groupId> <groupId>org.eclipse.jetty.example-async-rest</groupId>
<artifactId>example-async-rest-webapp</artifactId> <artifactId>example-async-rest-webapp</artifactId>

View File

@ -54,11 +54,6 @@
<artifactId>jetty-server</artifactId> <artifactId>jetty-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId> <artifactId>jetty-servlet</artifactId>
@ -66,15 +61,20 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.spdy</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>spdy-server</artifactId> <artifactId>jetty-alpn-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.npn</groupId> <groupId>org.eclipse.jetty.alpn</groupId>
<artifactId>npn-api</artifactId> <artifactId>alpn-api</artifactId>
<version>${npn.api.version}</version> <version>${alpn.api.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -21,7 +21,6 @@ package org.eclipse.jetty.http2.server;
import java.io.IOException; import java.io.IOException;
import java.util.Date; import java.util.Date;
import javax.servlet.Servlet; import javax.servlet.Servlet;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
@ -29,14 +28,11 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.eclipse.jetty.http2.generator.Generator; import org.eclipse.jetty.alpn.ALPN;
import org.eclipse.jetty.http2.hpack.HpackContext; import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory;
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.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer; import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; 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.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder; 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; import org.eclipse.jetty.util.ssl.SslContextFactory;
@ -92,21 +86,21 @@ public class Http2Server
// HTTP2 factory // HTTP2 factory
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config); HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
SPDYServerConnectionFactory.checkProtocolNegotiationAvailable(); NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
NPNServerConnectionFactory npn = ALPNServerConnectionFactory alpn =
new NPNServerConnectionFactory(h2.getProtocol(),http.getDefaultProtocol()); new ALPNServerConnectionFactory(h2.getProtocol(),http.getDefaultProtocol());
npn.setDefaultProtocol(http.getDefaultProtocol()); alpn.setDefaultProtocol(http.getDefaultProtocol());
// SSL Factory // SSL Factory
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,npn.getProtocol()); SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,alpn.getProtocol());
// SPDY Connector // SPDY Connector
ServerConnector http2Connector = 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); http2Connector.setPort(8443);
server.addConnector(http2Connector); server.addConnector(http2Connector);
NextProtoNego.debug=true; ALPN.debug=true;
server.start(); server.start();
server.dumpStdErr(); server.dumpStdErr();

View File

@ -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>

View File

@ -16,7 +16,7 @@
// ======================================================================== // ========================================================================
// //
package org.eclipse.jetty.spdy.client; package org.eclipse.jetty.npn.client;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@ -16,7 +16,7 @@
// ======================================================================== // ========================================================================
// //
package org.eclipse.jetty.spdy.client; package org.eclipse.jetty.npn.client;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;

View File

@ -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>

View File

@ -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>

View File

@ -23,6 +23,10 @@ protonego-impl
[depend] [depend]
protonego-impl/npn-${java.version} protonego-impl/npn-${java.version}
[lib]
lib/jetty-npn-client-${jetty.version}.jar
lib/jetty-npn-server-${jetty.version}.jar
[xml] [xml]
etc/protonego-npn.xml etc/protonego-npn.xml

View File

@ -16,7 +16,7 @@
// ======================================================================== // ========================================================================
// //
package org.eclipse.jetty.spdy.server; package org.eclipse.jetty.npn.server;
import java.util.List; import java.util.List;
import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLEngine;

View File

@ -16,7 +16,7 @@
// ======================================================================== // ========================================================================
// //
package org.eclipse.jetty.spdy.server; package org.eclipse.jetty.npn.server;
import java.util.List; import java.util.List;
import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLEngine;

15
jetty-npn/pom.xml Normal file
View File

@ -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>

View File

@ -27,11 +27,31 @@ import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.ssl.SslConnection; 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 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 final List<String> protocols;
private String defaultProtocol; private String defaultProtocol;

View File

@ -49,6 +49,11 @@
<artifactId>jetty-alpn-client</artifactId> <artifactId>jetty-alpn-client</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-npn-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.alpn</groupId> <groupId>org.eclipse.jetty.alpn</groupId>
<artifactId>alpn-api</artifactId> <artifactId>alpn-api</artifactId>

View File

@ -41,6 +41,7 @@ import org.eclipse.jetty.io.NegotiatingClientConnectionFactory;
import org.eclipse.jetty.io.SelectChannelEndPoint; import org.eclipse.jetty.io.SelectChannelEndPoint;
import org.eclipse.jetty.io.SelectorManager; import org.eclipse.jetty.io.SelectorManager;
import org.eclipse.jetty.io.ssl.SslClientConnectionFactory; 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.FlowControlStrategy;
import org.eclipse.jetty.spdy.api.GoAwayInfo; import org.eclipse.jetty.spdy.api.GoAwayInfo;
import org.eclipse.jetty.spdy.api.Session; import org.eclipse.jetty.spdy.api.Session;

View File

@ -84,7 +84,7 @@
<!-- NPN Connection factory with HTTP as default protocol --> <!-- NPN Connection factory with HTTP as default protocol -->
<Item> <Item>
<New class="org.eclipse.jetty.spdy.server.NPNServerConnectionFactory"> <New class="org.eclipse.jetty.npn.server.NPNServerConnectionFactory">
<Arg name="protocols"> <Arg name="protocols">
<Array type="String"> <Array type="String">
<Item>spdy/3</Item> <Item>spdy/3</Item>

View File

@ -86,6 +86,12 @@
<artifactId>jetty-client</artifactId> <artifactId>jetty-client</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-npn-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId> <artifactId>jetty-servlet</artifactId>

View File

@ -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>

View File

@ -21,6 +21,7 @@ package org.eclipse.jetty.spdy.server.http;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
import org.eclipse.jetty.server.AbstractConnectionFactory; import org.eclipse.jetty.server.AbstractConnectionFactory;
import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.HttpConfiguration; 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.Server;
import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.spdy.api.SPDY; import org.eclipse.jetty.spdy.api.SPDY;
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
public class HTTPSPDYServerConnector extends ServerConnector public class HTTPSPDYServerConnector extends ServerConnector

View File

@ -21,12 +21,12 @@ package org.eclipse.jetty.spdy.server.proxy;
import java.util.Objects; import java.util.Objects;
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory; import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.spdy.api.SPDY; 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.spdy.server.SPDYServerConnectionFactory;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;

View File

@ -18,10 +18,6 @@
package org.eclipse.jetty.spdy.server.http; 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.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -31,12 +27,12 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.Request; 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.StreamStatus;
import org.eclipse.jetty.spdy.api.SynInfo; import org.eclipse.jetty.spdy.api.SynInfo;
import org.eclipse.jetty.spdy.http.HTTPSPDYHeader; 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.Callback;
import org.eclipse.jetty.util.Fields; import org.eclipse.jetty.util.Fields;
import org.eclipse.jetty.util.Promise; import org.eclipse.jetty.util.Promise;
@ -68,6 +63,10 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; 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 public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
{ {
private static final Logger LOG = Log.getLogger(ReferrerPushStrategyTest.class); private static final Logger LOG = Log.getLogger(ReferrerPushStrategyTest.class);

View File

@ -52,6 +52,12 @@
<version>${npn.api.version}</version> <version>${npn.api.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-npn-server</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-start</artifactId> <artifactId>jetty-start</artifactId>

View File

@ -18,7 +18,7 @@
package org.eclipse.jetty.spdy.server.proxy; 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 public class NPNProxySPDYToHTTPLoadTest extends ProxySPDYToHTTPLoadTest
{ {

View File

@ -55,6 +55,11 @@
<artifactId>jetty-server</artifactId> <artifactId>jetty-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-npn-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.npn</groupId> <groupId>org.eclipse.jetty.npn</groupId>
<artifactId>npn-api</artifactId> <artifactId>npn-api</artifactId>

View File

@ -47,37 +47,6 @@ import org.eclipse.jetty.util.annotation.ManagedObject;
@ManagedObject("SPDY Server Connection Factory") @ManagedObject("SPDY Server Connection Factory")
public class SPDYServerConnectionFactory extends AbstractConnectionFactory 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 Queue<Session> sessions = new ConcurrentLinkedQueue<>();
private final short version; private final short version;
private final ServerSessionFrameListener listener; private final ServerSessionFrameListener listener;

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.spdy.server;
import java.util.Objects; import java.util.Objects;
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory; import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;

View File

@ -22,6 +22,7 @@ package org.eclipse.jetty.spdy.server;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.ServerConnector;

View File

@ -456,10 +456,11 @@
<module>jetty-http-spi</module> <module>jetty-http-spi</module>
<module>jetty-osgi</module> <module>jetty-osgi</module>
<module>jetty-alpn</module> <module>jetty-alpn</module>
<module>jetty-npn</module>
<!-- modules that need fixed and added back, or simply dropped and not maintained <!-- modules that need fixed and added back, or simply dropped and not maintained
<module>jetty-rhttp</module> <module>jetty-rhttp</module>
--> -->
<!--<module>jetty-overlay-deployer</module>--> <!--<module>jetty-overlay-deployer</module>-->
</modules> </modules>
<dependencyManagement> <dependencyManagement>

View File

@ -21,10 +21,12 @@ package org.eclipse.jetty;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import org.eclipse.jetty.jmx.MBeanContainer; import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.npn.server.NPNServerConnectionFactory;
import org.eclipse.jetty.server.ForwardedRequestCustomizer; import org.eclipse.jetty.server.ForwardedRequestCustomizer;
import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer; import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; 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.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler; import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerCollection; 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.HTTPSPDYServerConnectionFactory;
import org.eclipse.jetty.spdy.server.http.PushStrategy; import org.eclipse.jetty.spdy.server.http.PushStrategy;
import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy; import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy;
@ -102,7 +102,7 @@ public class TestTransparentProxyServer
// Spdy Connector // Spdy Connector
SPDYServerConnectionFactory.checkProtocolNegotiationAvailable(); NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
PushStrategy push = new ReferrerPushStrategy(); PushStrategy push = new ReferrerPushStrategy();
HTTPSPDYServerConnectionFactory spdy2 = new HTTPSPDYServerConnectionFactory(2,config,push); HTTPSPDYServerConnectionFactory spdy2 = new HTTPSPDYServerConnectionFactory(2,config,push);
spdy2.setInputBufferSize(8192); spdy2.setInputBufferSize(8192);