jetty-9 - Reorganized SPDY modules.

This change was due to the fact that the old spdy-core and spdy-jetty modules had classes in the same package,
which is a problem for OSGi.
The old spdy-jetty module has been split in 2: spdy-client and spdy-server, and other SPDY modules just underwent a
renaming to make them more sound.
This commit is contained in:
Simone Bordet 2012-09-18 23:33:30 +02:00
parent eb7501405f
commit bfe08d1a99
77 changed files with 417 additions and 452 deletions

View File

@ -41,7 +41,7 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-jetty-http</artifactId>
<artifactId>spdy-http-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>

View File

@ -25,13 +25,13 @@ import org.eclipse.jetty.server.ForwardedRequestCustomizer;
import org.eclipse.jetty.server.HttpChannelConfig;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.spdy.NPNServerConnectionFactory;
import org.eclipse.jetty.spdy.http.PushStrategy;
import org.eclipse.jetty.spdy.http.ReferrerPushStrategy;
import org.eclipse.jetty.spdy.http.HTTPSPDYServerConnectionFactory;
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
import org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory;
import org.eclipse.jetty.spdy.server.http.PushStrategy;
import org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.TimerScheduler;
@ -47,7 +47,7 @@ public class ManyConnectors
{
String jetty_home = System.getProperty("jetty.home","../jetty-server/src/main/config");
System.setProperty("jetty.home", jetty_home);
Server server = new Server();
// HTTP connector
@ -60,13 +60,13 @@ public class ManyConnectors
sslContextFactory.setKeyStorePath(jetty_home + "/etc/keystore");
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
ServerConnector connector1 = new ServerConnector(server,sslContextFactory);
connector1.setPort(8443);
// A verbosely fully configured connector with SSL, SPDY and HTTP
HttpChannelConfig config = new HttpChannelConfig();
config.setSecureScheme("https");
config.setSecurePort(8443);
@ -75,39 +75,39 @@ public class ManyConnectors
config.setResponseHeaderSize(8192);
config.addCustomizer(new ForwardedRequestCustomizer());
config.addCustomizer(new SecureRequestCustomizer());
HttpConnectionFactory http = new HttpConnectionFactory(config);
http.setInputBufferSize(16384);
PushStrategy push = new ReferrerPushStrategy();
HTTPSPDYServerConnectionFactory spdy2 = new HTTPSPDYServerConnectionFactory(2,config,push);
spdy2.setInputBufferSize(8192);
spdy2.setInitialWindowSize(32768);
HTTPSPDYServerConnectionFactory spdy3 = new HTTPSPDYServerConnectionFactory(3,config,push);
spdy2.setInputBufferSize(8192);
NPNServerConnectionFactory npn = new NPNServerConnectionFactory(spdy3.getProtocol(),spdy2.getProtocol(),http.getProtocol());
npn.setDefaultProtocol(http.getProtocol());
npn.setInputBufferSize(1024);
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,npn.getProtocol());
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setMaxThreads(256);
TimerScheduler scheduler = new TimerScheduler();
ByteBufferPool bufferPool= new ArrayByteBufferPool(32,4096,32768);
ServerConnector connector2 = new ServerConnector(server,threadPool,scheduler,bufferPool,2,2,ssl,npn,spdy3,spdy2,http);
ServerConnector connector2 = new ServerConnector(server,threadPool,scheduler,bufferPool,2,2,ssl,npn,spdy3,spdy2,http);
connector2.setDefaultProtocol("ssl-npn");
connector2.setPort(8444);
connector2.setIdleTimeout(30000);
connector2.setSoLingerTime(10000);
// Set the connectors
server.setConnectors(new Connector[] { connector0, connector1, connector2 });
server.setHandler(new HelloHandler());
server.start();

View File

@ -309,7 +309,7 @@
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.security.auth.message</artifactId>
</dependency>
<!-- jetty deps -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
@ -342,7 +342,7 @@
<artifactId>websocket-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
@ -354,14 +354,14 @@
<artifactId>jetty-plus</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<version>${project.version}</version>
</dependency>
<!--
<!--
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-rewrite</artifactId>
@ -440,7 +440,7 @@
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-jetty-http-webapp</artifactId>
<artifactId>spdy-example-webapp</artifactId>
<version>${project.version}</version>
<type>war</type>
<overWrite>true</overWrite>
@ -470,27 +470,32 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-jetty</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-jetty-http</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-jetty-http-webapp</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-http-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-example-webapp</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
</profile>
</profiles>

View File

@ -18,9 +18,10 @@
<modules>
<module>spdy-core</module>
<module>spdy-jetty</module>
<module>spdy-jetty-http</module>
<module>spdy-jetty-http-webapp</module>
<module>spdy-client</module>
<module>spdy-server</module>
<module>spdy-http-server</module>
<module>spdy-example-webapp</module>
</modules>
<build>

View File

@ -7,8 +7,8 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spdy-jetty</artifactId>
<name>Jetty :: SPDY :: Jetty Binding</name>
<artifactId>spdy-client</artifactId>
<name>Jetty :: SPDY :: Jetty Client Binding</name>
<build>
<plugins>
@ -51,11 +51,6 @@
<artifactId>spdy-core</artifactId>
<version>${project.version}</version>
</dependency>
<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>
@ -65,13 +60,13 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -16,8 +16,10 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.client;
import org.eclipse.jetty.spdy.FlowControlStrategy;
import org.eclipse.jetty.spdy.SPDYv3FlowControlStrategy;
import org.eclipse.jetty.spdy.api.SPDY;
public class FlowControlStrategyFactory

View File

@ -16,13 +16,12 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.client;
import java.io.IOException;
import java.nio.channels.SocketChannel;
import java.util.List;
import java.util.concurrent.Executor;
import javax.net.ssl.SSLEngine;
import org.eclipse.jetty.io.AbstractConnection;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.client;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -40,6 +40,8 @@ import org.eclipse.jetty.io.SelectChannelEndPoint;
import org.eclipse.jetty.io.SelectorManager;
import org.eclipse.jetty.io.ssl.SslConnection;
import org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint;
import org.eclipse.jetty.spdy.FlowControlStrategy;
import org.eclipse.jetty.spdy.Promise;
import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.SessionFrameListener;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
@ -240,7 +242,7 @@ public class SPDYClient
sessions.clear();
}
protected Collection<Session> getSessions()
public Collection<Session> getSessions()
{
return Collections.unmodifiableCollection(sessions);
}

View File

@ -16,19 +16,23 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.client;
import java.nio.channels.SocketChannel;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.spdy.SPDYClient.Factory;
import org.eclipse.jetty.spdy.SPDYClient.SessionPromise;
import org.eclipse.jetty.spdy.CompressionFactory;
import org.eclipse.jetty.spdy.FlowControlStrategy;
import org.eclipse.jetty.spdy.StandardCompressionFactory;
import org.eclipse.jetty.spdy.StandardSession;
import org.eclipse.jetty.spdy.client.SPDYClient.Factory;
import org.eclipse.jetty.spdy.client.SPDYClient.SessionPromise;
import org.eclipse.jetty.spdy.generator.Generator;
import org.eclipse.jetty.spdy.parser.Parser;
public class SPDYClientConnectionFactory
public class SPDYClientConnectionFactory
{
public Connection newConnection(SocketChannel channel, EndPoint endPoint, Object attachment)
{

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.client;
import java.io.IOException;
import java.nio.ByteBuffer;
@ -26,6 +26,10 @@ import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.RuntimeIOException;
import org.eclipse.jetty.spdy.Controller;
import org.eclipse.jetty.spdy.ISession;
import org.eclipse.jetty.spdy.IdleListener;
import org.eclipse.jetty.spdy.StandardSession;
import org.eclipse.jetty.spdy.parser.Parser;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.log.Log;
@ -39,13 +43,13 @@ public class SPDYConnection extends AbstractConnection implements Controller<Sta
private final int bufferSize;
private volatile ISession session;
private volatile boolean idle = false;
public SPDYConnection(EndPoint endPoint, ByteBufferPool bufferPool, Parser parser, Executor executor)
{
this(endPoint,bufferPool,parser,executor,8192);
}
public SPDYConnection(EndPoint endPoint, ByteBufferPool bufferPool, Parser parser, Executor executor,int bufferSize)
{
super(endPoint, executor);
@ -65,7 +69,7 @@ public class SPDYConnection extends AbstractConnection implements Controller<Sta
@Override
public void onFillable()
{
ByteBuffer buffer = bufferPool.acquire(bufferSize, true);
ByteBuffer buffer = bufferPool.acquire(bufferSize, true);
boolean readMore = read(buffer) == 0;
bufferPool.release(buffer);
if (readMore)
@ -173,7 +177,7 @@ public class SPDYConnection extends AbstractConnection implements Controller<Sta
return session;
}
protected void setSession(ISession session)
public void setSession(ISession session)
{
this.session = session;
}

View File

@ -6,9 +6,9 @@
<version>9.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spdy-jetty-http-webapp</artifactId>
<artifactId>spdy-example-webapp</artifactId>
<packaging>war</packaging>
<name>Jetty :: SPDY :: Jetty HTTP Web Application</name>
<name>Jetty :: SPDY :: Example Web Application</name>
<build>
<plugins>

View File

@ -20,7 +20,7 @@
-->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnector">
<New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnector">
<Arg>
<Ref id="Server"/>
</Arg>
@ -37,9 +37,9 @@
<!--
This ProxyEngine translates the incoming SPDY/x(HTTP) request to SPDY/2(HTTP)
-->
<New id="spdyProxyEngine" class="org.eclipse.jetty.spdy.proxy.SPDYProxyEngine">
<New id="spdyProxyEngine" class="org.eclipse.jetty.spdy.server.proxy.SPDYProxyEngine">
<Arg>
<New class="org.eclipse.jetty.spdy.SPDYClient$Factory">
<New class="org.eclipse.jetty.spdy.client.SPDYClient$Factory">
<Call name="start"/>
</New>
</Arg>
@ -51,7 +51,7 @@
Such requests are converted from SPDY/x(HTTP) to SPDY/2(HTTP) by the configured ProxyEngine
and forwarded to 127.0.0.1:9090, where they are served by the upstream server above.
-->
<New id="proxyEngineSelector" class="org.eclipse.jetty.spdy.proxy.ProxyEngineSelector">
<New id="proxyEngineSelector" class="org.eclipse.jetty.spdy.server.proxy.ProxyEngineSelector">
<Call name="putProxyEngine">
<Arg>spdy/2</Arg>
<Arg><Ref id="spdyProxyEngine" /></Arg>
@ -61,7 +61,7 @@
<Entry>
<Item>localhost</Item>
<Item>
<New class="org.eclipse.jetty.spdy.proxy.ProxyEngineSelector$ProxyServerInfo">
<New class="org.eclipse.jetty.spdy.server.proxy.ProxyEngineSelector$ProxyServerInfo">
<Arg type="String">spdy/2</Arg>
<Arg>127.0.0.1</Arg>
<Arg type="int">9090</Arg>
@ -81,7 +81,7 @@
-->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.spdy.proxy.HTTPSPDYProxyConnector">
<New class="org.eclipse.jetty.spdy.server.proxy.HTTPSPDYProxyConnector">
<Arg>
<Ref id="Server"/>
</Arg>
@ -94,7 +94,7 @@
</Call>
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.spdy.proxy.HTTPSPDYProxyConnector">
<New class="org.eclipse.jetty.spdy.server.proxy.HTTPSPDYProxyConnector">
<Arg>
<Ref id="Server"/>
</Arg>

View File

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Setup a SSL Context factory -->
<!-- =========================================================== -->
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="KeyStorePath"><Property name="jetty.home" default="."/>/etc/keystore
</Set>
<Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
<Set name="TrustStorePath"><Property name="jetty.home" default="."/>/etc/keystore
</Set>
<Set name="TrustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
</New>
<!-- =========================================================== -->
<!-- Add HTTP Customizer for Secure request -->
<!-- =========================================================== -->
<Ref id="httpConfig">
<Call name="addCustomizer">
<Arg>
<New class="org.eclipse.jetty.server.SecureRequestCustomizer"/>
</Arg>
</Call>
</Ref>
<!-- =========================================================== -->
<!-- Create a push strategy -->
<!-- =========================================================== -->
<New id="pushStrategy" class="org.eclipse.jetty.spdy.server.http.ReferrerPushStrategy">
<Arg type="List">
<Array type="String">
<Item>.*\.css</Item>
<Item>.*\.js</Item>
<Item>.*\.png</Item>
<Item>.*\.jpg</Item>
<Item>.*\.gif</Item>
</Array>
</Arg>
</New>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<Call id="sslConnector" name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server">
<Ref id="Server"/>
</Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.SslConnectionFactory">
<Arg name="next">npn</Arg>
<Arg name="sslContextFactory">
<Ref id="sslContextFactory"/>
</Arg>
</New>
</Item>
<Item>
<New 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>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory">
<Arg name="version" type="int">3</Arg>
<Arg name="config">
<Ref id="httpConfig"/>
</Arg>
<!-- <Arg name="pushStrategy"><Ref id="pushStrategy"/></Arg> -->
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory">
<Arg name="version" type="int">2</Arg>
<Arg name="config">
<Ref id="httpConfig"/>
</Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config">
<Ref id="httpConfig"/>
</Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host">
<Property name="jetty.host"/>
</Set>
<Set name="port">8443</Set>
<Set name="idleTimeout">30000</Set>
</New>
</Arg>
</Call>
</Configure>

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -6,8 +6,8 @@
<version>9.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spdy-jetty-http</artifactId>
<name>Jetty :: SPDY :: Jetty HTTP Layer</name>
<artifactId>spdy-http-server</artifactId>
<name>Jetty :: SPDY :: Jetty Server HTTP Layer</name>
<build>
<plugins>
@ -47,7 +47,7 @@
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-jetty</artifactId>
<artifactId>spdy-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.util.HashMap;
import java.util.Map;

View File

@ -17,12 +17,11 @@
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.HttpChannelConfig;
import org.eclipse.jetty.spdy.SPDYServerConnectionFactory;
import org.eclipse.jetty.spdy.api.DataInfo;
import org.eclipse.jetty.spdy.api.HeadersInfo;
import org.eclipse.jetty.spdy.api.ReplyInfo;
@ -30,6 +29,7 @@ import org.eclipse.jetty.spdy.api.Stream;
import org.eclipse.jetty.spdy.api.StreamFrameListener;
import org.eclipse.jetty.spdy.api.SynInfo;
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.spdy.server.SPDYServerConnectionFactory;
import org.eclipse.jetty.util.Fields;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.log.Log;
@ -37,22 +37,22 @@ import org.eclipse.jetty.util.log.Logger;
public class HTTPSPDYServerConnectionFactory extends SPDYServerConnectionFactory implements HttpChannelConfig.ConnectionFactory
{
private static final String CHANNEL_ATTRIBUTE = "org.eclipse.jetty.spdy.http.HTTPChannelOverSPDY";
private static final String CHANNEL_ATTRIBUTE = "org.eclipse.jetty.spdy.server.http.HTTPChannelOverSPDY";
private static final Logger logger = Log.getLogger(HTTPSPDYServerConnectionFactory.class);
private final PushStrategy pushStrategy;
private final HttpChannelConfig httpChannelConfig;
public HTTPSPDYServerConnectionFactory(
@Name("version") int version,
@Name("version") int version,
@Name("config") HttpChannelConfig config)
{
this(version,config,new PushStrategy.None());
}
public HTTPSPDYServerConnectionFactory(
@Name("version") int version,
@Name("config") HttpChannelConfig config,
@Name("version") int version,
@Name("config") HttpChannelConfig config,
@Name("pushStrategy") PushStrategy pushStrategy)
{
super(version);
@ -66,7 +66,7 @@ public class HTTPSPDYServerConnectionFactory extends SPDYServerConnectionFactory
{
return httpChannelConfig;
}
@Override
protected ServerSessionFrameListener provideServerSessionFrameListener(Connector connector, EndPoint endPoint)
{

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.util.Collections;
import java.util.Map;
@ -26,12 +26,10 @@ import org.eclipse.jetty.server.AbstractConnectionFactory;
import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.HttpChannelConfig;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.spdy.NPNServerConnectionFactory;
import org.eclipse.jetty.spdy.SPDYServerConnector;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.spdy.api.SPDY;
import org.eclipse.jetty.spdy.http.PushStrategy.None;
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
import org.eclipse.jetty.util.ssl.SslContextFactory;
public class HTTPSPDYServerConnector extends ServerConnector
@ -59,9 +57,9 @@ public class HTTPSPDYServerConnector extends ServerConnector
public HTTPSPDYServerConnector(Server server, short version, HttpChannelConfig httpChannelConfig, PushStrategy push)
{
super(server,new HTTPSPDYServerConnectionFactory(version,httpChannelConfig,push));
}
public HTTPSPDYServerConnector(Server server, HttpChannelConfig config, SslContextFactory sslContextFactory, Map<Short, PushStrategy> pushStrategies)
{
super(server,AbstractConnectionFactory.getFactories(sslContextFactory,

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.nio.ByteBuffer;
import java.util.LinkedList;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import org.eclipse.jetty.server.HttpInput;
import org.eclipse.jetty.spdy.api.DataInfo;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.io.IOException;
import java.nio.ByteBuffer;

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.util.Collections;
import java.util.Set;

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.util.Arrays;
import java.util.Collections;

View File

@ -17,12 +17,12 @@
//
package org.eclipse.jetty.spdy.proxy;
package org.eclipse.jetty.spdy.server.proxy;
import org.eclipse.jetty.server.HttpChannelConfig;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.spdy.SPDYServerConnector;
import org.eclipse.jetty.spdy.api.SPDY;
import org.eclipse.jetty.spdy.server.SPDYServerConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory;
public class HTTPSPDYProxyConnector extends SPDYServerConnector

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy.proxy;
package org.eclipse.jetty.spdy.server.proxy;
import java.net.InetAddress;
import java.net.InetSocketAddress;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.proxy;
package org.eclipse.jetty.spdy.server.proxy;
import java.net.InetSocketAddress;
import java.util.HashMap;
@ -32,7 +32,7 @@ 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.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.spdy.http.HTTPSPDYHeader;
import org.eclipse.jetty.spdy.server.http.HTTPSPDYHeader;
import org.eclipse.jetty.util.Fields;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;

View File

@ -17,14 +17,13 @@
//
package org.eclipse.jetty.spdy.proxy;
package org.eclipse.jetty.spdy.server.proxy;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.server.AbstractConnectionFactory;
import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.HttpChannelConfig;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.proxy;
package org.eclipse.jetty.spdy.server.proxy;
import java.io.IOException;
import java.nio.ByteBuffer;
@ -49,7 +49,7 @@ import org.eclipse.jetty.spdy.api.SessionStatus;
import org.eclipse.jetty.spdy.api.Stream;
import org.eclipse.jetty.spdy.api.StreamFrameListener;
import org.eclipse.jetty.spdy.api.SynInfo;
import org.eclipse.jetty.spdy.http.HTTPSPDYHeader;
import org.eclipse.jetty.spdy.server.http.HTTPSPDYHeader;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.Fields;

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy.proxy;
package org.eclipse.jetty.spdy.server.proxy;
import java.net.InetSocketAddress;
import java.util.LinkedList;
@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.spdy.SPDYClient;
import org.eclipse.jetty.spdy.api.ByteBufferDataInfo;
import org.eclipse.jetty.spdy.api.DataInfo;
import org.eclipse.jetty.spdy.api.GoAwayInfo;
@ -40,7 +39,8 @@ import org.eclipse.jetty.spdy.api.Stream;
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.client.SPDYClient;
import org.eclipse.jetty.spdy.server.http.HTTPSPDYHeader;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.Fields;
@ -50,8 +50,8 @@ import org.eclipse.jetty.util.Fields;
*/
public class SPDYProxyEngine extends ProxyEngine implements StreamFrameListener
{
private static final String STREAM_HANDLER_ATTRIBUTE = "org.eclipse.jetty.spdy.http.proxy.streamHandler";
private static final String CLIENT_STREAM_ATTRIBUTE = "org.eclipse.jetty.spdy.http.proxy.clientStream";
private static final String STREAM_HANDLER_ATTRIBUTE = "org.eclipse.jetty.spdy.server.http.proxy.streamHandler";
private static final String CLIENT_STREAM_ATTRIBUTE = "org.eclipse.jetty.spdy.server.http.proxy.clientStream";
private final ConcurrentMap<String, Session> serverSessions = new ConcurrentHashMap<>();
private final SessionFrameListener sessionListener = new ProxySessionFrameListener();

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.net.InetSocketAddress;
import java.util.Arrays;
@ -24,15 +24,13 @@ import java.util.Collection;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpChannelConfig;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.spdy.SPDYClient;
import org.eclipse.jetty.spdy.SPDYServerConnector;
import org.eclipse.jetty.spdy.api.SPDY;
import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.SessionFrameListener;
import org.eclipse.jetty.spdy.client.SPDYClient;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.After;
import org.junit.Rule;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.io.BufferedReader;
import java.io.InputStream;
@ -31,7 +31,7 @@ import javax.net.ssl.SSLSocket;
import org.eclipse.jetty.npn.NextProtoNego;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.spdy.SPDYServerConnector;
import org.eclipse.jetty.spdy.server.SPDYServerConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Assert;
import org.junit.Rule;

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.io.IOException;
import java.net.InetSocketAddress;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.io.IOException;
import java.io.PrintWriter;
@ -31,8 +31,6 @@ import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.HttpChannelConfig;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.spdy.NPNServerConnectionFactory;
import org.eclipse.jetty.spdy.SPDYServerConnector;
import org.eclipse.jetty.spdy.api.DataInfo;
import org.eclipse.jetty.spdy.api.ReplyInfo;
import org.eclipse.jetty.spdy.api.SPDY;
@ -41,6 +39,7 @@ import org.eclipse.jetty.spdy.api.SessionFrameListener;
import org.eclipse.jetty.spdy.api.Stream;
import org.eclipse.jetty.spdy.api.StreamFrameListener;
import org.eclipse.jetty.spdy.api.SynInfo;
import org.eclipse.jetty.spdy.server.NPNServerConnectionFactory;
import org.eclipse.jetty.util.Fields;
import org.junit.Assert;
import org.junit.Test;
@ -77,7 +76,7 @@ public class ReferrerPushStrategyTest extends AbstractHTTPSPDYTest
connector.getConnectionFactory(NPNServerConnectionFactory.class).setDefaultProtocol(defaultFactory.getProtocol());
else
connector.setDefaultProtocol(defaultFactory.getProtocol());
connector.setDefaultProtocol(defaultFactory.getProtocol()); // TODO I don't think this is right
Fields mainRequestHeaders = createHeadersWithoutReferrer(mainResource);

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.util.Set;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -27,12 +27,12 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.jetty.spdy.SPDYClient;
import org.eclipse.jetty.spdy.api.ReplyInfo;
import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.Stream;
import org.eclipse.jetty.spdy.api.StreamFrameListener;
import org.eclipse.jetty.spdy.api.SynInfo;
import org.eclipse.jetty.spdy.client.SPDYClient;
import org.eclipse.jetty.util.Fields;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Assert;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.http;
package org.eclipse.jetty.spdy.server.http;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy.proxy;
package org.eclipse.jetty.spdy.server.proxy;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
@ -31,9 +31,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.spdy.SPDYClient;
import org.eclipse.jetty.spdy.SPDYServerConnector;
import org.eclipse.jetty.spdy.SPDYServerConnectionFactory;
import org.eclipse.jetty.spdy.api.BytesDataInfo;
import org.eclipse.jetty.spdy.api.DataInfo;
import org.eclipse.jetty.spdy.api.GoAwayInfo;
@ -48,7 +45,10 @@ 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.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.spdy.http.HTTPSPDYHeader;
import org.eclipse.jetty.spdy.client.SPDYClient;
import org.eclipse.jetty.spdy.server.SPDYServerConnectionFactory;
import org.eclipse.jetty.spdy.server.SPDYServerConnector;
import org.eclipse.jetty.spdy.server.http.HTTPSPDYHeader;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.Fields;
import org.junit.After;

View File

@ -1,102 +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="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Setup a SSL Context factory -->
<!-- =========================================================== -->
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="KeyStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
<Set name="TrustStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="TrustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
</New>
<!-- =========================================================== -->
<!-- Add HTTP Customizer for Secure request -->
<!-- =========================================================== -->
<Ref id="httpConfig">
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
</Call>
</Ref>
<!-- =========================================================== -->
<!-- Create a push strategy -->
<!-- =========================================================== -->
<New id="pushStrategy" class="org.eclipse.jetty.spdy.http.ReferrerPushStrategy">
<Arg type="List">
<Array type="String">
<Item>.*\.css</Item>
<Item>.*\.js</Item>
<Item>.*\.png</Item>
<Item>.*\.jpg</Item>
<Item>.*\.gif</Item>
</Array>
</Arg>
</New>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<Call id="sslConnector" name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref id="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.SslConnectionFactory">
<Arg name="next">npn</Arg>
<Arg name="sslContextFactory"><Ref id="sslContextFactory"/></Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.spdy.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>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnectionFactory">
<Arg name="version" type="int">3</Arg>
<Arg name="config"><Ref id="httpConfig"/></Arg>
<!-- <Arg name="pushStrategy"><Ref id="pushStrategy"/></Arg> -->
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.spdy.http.HTTPSPDYServerConnectionFactory">
<Arg name="version" type="int">2</Arg>
<Arg name="config"><Ref id="httpConfig"/></Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref id="httpConfig"/></Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port">8443</Set>
<Set name="idleTimeout">30000</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -1,148 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.spdy;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ReadPendingException;
import java.nio.channels.WritePendingException;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.Callback;
public class EmptyEndPoint implements EndPoint
{
private boolean checkForIdle;
private Connection connection;
private boolean oshut;
private boolean closed;
private long maxIdleTime;
@Override
public long getCreatedTimeStamp()
{
return 0;
}
@Override
public Connection getConnection()
{
return connection;
}
@Override
public void setConnection(Connection connection)
{
this.connection = connection;
}
@Override
public void shutdownOutput()
{
oshut = true;
}
@Override
public boolean isOutputShutdown()
{
return oshut;
}
@Override
public boolean isInputShutdown()
{
return false;
}
@Override
public void close()
{
closed = true;
}
@Override
public int fill(ByteBuffer buffer) throws IOException
{
return 0;
}
@Override
public boolean flush(ByteBuffer... buffer) throws IOException
{
return false;
}
@Override
public InetSocketAddress getLocalAddress()
{
return null;
}
@Override
public InetSocketAddress getRemoteAddress()
{
return null;
}
@Override
public boolean isOpen()
{
return !closed;
}
@Override
public Object getTransport()
{
return null;
}
@Override
public long getIdleTimeout()
{
return maxIdleTime;
}
@Override
public void setIdleTimeout(long timeMs)
{
this.maxIdleTime = timeMs;
}
@Override
public void onOpen()
{
}
@Override
public void onClose()
{
}
@Override
public <C> void fillInterested(C context, Callback<C> callback) throws ReadPendingException
{
}
@Override
public <C> void write(C context, Callback<C> callback, ByteBuffer... buffers) throws WritePendingException
{
}
}

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-parent</artifactId>
<version>9.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spdy-server</artifactId>
<name>Jetty :: SPDY :: Jetty Server Binding</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.mortbay.jetty.npn</groupId>
<artifactId>npn-boot</artifactId>
<version>${npn.version}</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/npn</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xbootclasspath/p:${project.build.directory}/npn/npn-boot-${npn.version}.jar</argLine>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
<artifactId>spdy-client</artifactId>
<version>${project.version}</version>
</dependency>
<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.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.util.Arrays;
import java.util.Iterator;
@ -81,7 +81,7 @@ public class NPNServerConnectionFactory extends AbstractConnectionFactory
@Override
public Connection newConnection(Connector connector, EndPoint endPoint)
{
List<String> protocols=_protocols;
List<String> protocols=_protocols;
if (protocols==null || protocols.size()==0)
{
protocols=connector.getProtocols();
@ -92,11 +92,11 @@ public class NPNServerConnectionFactory extends AbstractConnectionFactory
i.remove();
}
}
String dft=_defaultProtocol;
if (dft==null)
dft=_protocols.get(0);
return new NextProtoNegoServerConnection((DecryptedEndPoint)endPoint, connector,protocols,_defaultProtocol);
}

View File

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

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.util.Collection;
import java.util.Collections;
@ -28,8 +28,14 @@ import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.server.AbstractConnectionFactory;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.spdy.CompressionFactory;
import org.eclipse.jetty.spdy.FlowControlStrategy;
import org.eclipse.jetty.spdy.StandardCompressionFactory;
import org.eclipse.jetty.spdy.StandardSession;
import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.spdy.client.FlowControlStrategyFactory;
import org.eclipse.jetty.spdy.client.SPDYConnection;
import org.eclipse.jetty.spdy.generator.Generator;
import org.eclipse.jetty.spdy.parser.Parser;
@ -39,7 +45,7 @@ public class SPDYServerConnectionFactory extends AbstractConnectionFactory
private final ServerSessionFrameListener listener;
private int initialWindowSize;
private final Queue<Session> sessions = new ConcurrentLinkedQueue<>();
public SPDYServerConnectionFactory(int version)
{
this(version, null);
@ -62,7 +68,7 @@ public class SPDYServerConnectionFactory extends AbstractConnectionFactory
{
return listener;
}
@Override
public Connection newConnection(Connector connector, EndPoint endPoint)
{

View File

@ -16,12 +16,12 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.spdy.api.SPDY;
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.util.ssl.SslContextFactory;
@ -46,7 +46,7 @@ public class SPDYServerConnector extends ServerConnector
new SPDYServerConnectionFactory(SPDY.V3, listener)});
if (getConnectionFactory(NPNServerConnectionFactory.class)!=null)
getConnectionFactory(NPNServerConnectionFactory.class).setDefaultProtocol("http/1.1");
}
}

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.net.InetSocketAddress;
import java.util.concurrent.Executor;
@ -29,6 +29,7 @@ import org.eclipse.jetty.spdy.api.SPDY;
import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.SessionFrameListener;
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.spdy.client.SPDYClient;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.After;
@ -68,17 +69,17 @@ public abstract class AbstractTest
connector = newSPDYServerConnector(server, listener);
if (listener == null)
listener = connector.getConnectionFactory(SPDYServerConnectionFactory.class).getServerSessionFrameListener();
ConnectionFactory spdy = new SPDYServerConnectionFactory(version, listener);
connector.addConnectionFactory(spdy);
connector.setPort(0);
server.addConnector(connector);
if (connector.getConnectionFactory(NPNServerConnectionFactory.class)!=null)
connector.getConnectionFactory(NPNServerConnectionFactory.class).setDefaultProtocol(spdy.getProtocol());
else
connector.setDefaultProtocol(spdy.getProtocol());
server.start();
return new InetSocketAddress("localhost", connector.getLocalPort());
}
@ -109,7 +110,7 @@ public abstract class AbstractTest
clientFactory = newSPDYClientFactory(threadPool);
clientFactory.start();
}
return clientFactory.newSPDYClient(version).connect(socketAddress, listener).get(5, TimeUnit.SECONDS);
}

View File

@ -16,11 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
package org.eclipse.jetty.spdy.server;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -31,6 +27,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.io.MappedByteBufferPool;
import org.eclipse.jetty.spdy.StandardCompressionFactory;
import org.eclipse.jetty.spdy.api.BytesDataInfo;
import org.eclipse.jetty.spdy.api.DataInfo;
import org.eclipse.jetty.spdy.api.GoAwayInfo;
@ -56,6 +53,10 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
public class ClosedStreamTest extends AbstractTest
{
//TODO: Right now it sends a rst as the stream is unknown to the session once it's closed.

View File

@ -17,10 +17,7 @@
//
package org.eclipse.jetty.spdy;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
package org.eclipse.jetty.spdy.server;
import java.nio.ByteBuffer;
import java.util.concurrent.Callable;
@ -48,6 +45,9 @@ import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.junit.Assert;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
public class FlowControlTest extends AbstractTest
{
@Test
@ -189,7 +189,7 @@ public class FlowControlTest extends AbstractTest
}
}
});
DataInfo dataInfo = exchanger.exchange(null, 5, TimeUnit.SECONDS);
checkThatWeAreFlowControlStalled(exchanger);

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.nio.channels.ClosedChannelException;
import java.util.concurrent.CountDownLatch;

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.net.InetSocketAddress;
import java.util.concurrent.CountDownLatch;
@ -32,6 +32,7 @@ import org.eclipse.jetty.spdy.api.Stream;
import org.eclipse.jetty.spdy.api.StreamFrameListener;
import org.eclipse.jetty.spdy.api.SynInfo;
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.spdy.client.SPDYClient;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.Assert;
import org.junit.Test;

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

View File

@ -16,10 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
package org.eclipse.jetty.spdy.server;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
@ -29,6 +26,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.io.MappedByteBufferPool;
import org.eclipse.jetty.spdy.StandardCompressionFactory;
import org.eclipse.jetty.spdy.api.BytesDataInfo;
import org.eclipse.jetty.spdy.api.DataInfo;
import org.eclipse.jetty.spdy.api.HeadersInfo;
@ -49,6 +47,9 @@ import org.eclipse.jetty.util.Fields;
import org.junit.Assert;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
public class ProtocolViolationsTest extends AbstractTest
{
@Test

View File

@ -17,13 +17,7 @@
//
package org.eclipse.jetty.spdy;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.sameInstance;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
package org.eclipse.jetty.spdy.server;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -40,6 +34,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jetty.io.MappedByteBufferPool;
import org.eclipse.jetty.spdy.StandardCompressionFactory;
import org.eclipse.jetty.spdy.api.BytesDataInfo;
import org.eclipse.jetty.spdy.api.DataInfo;
import org.eclipse.jetty.spdy.api.GoAwayInfo;
@ -69,6 +64,12 @@ import org.eclipse.jetty.util.Fields;
import org.junit.Assert;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.sameInstance;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
public class PushStreamTest extends AbstractTest
{
@Test

View File

@ -16,13 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
package org.eclipse.jetty.spdy.server;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@ -41,6 +35,12 @@ import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.util.Callback;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
public class ResetStreamTest extends AbstractTest
{
@Test

View File

@ -17,13 +17,12 @@
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
import org.eclipse.jetty.spdy.api.GoAwayInfo;
import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;

View File

@ -17,13 +17,12 @@
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
import org.eclipse.jetty.spdy.api.GoAwayInfo;
import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.SessionFrameListener;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.lang.reflect.Field;
import java.util.Map;
@ -27,6 +27,7 @@ import org.eclipse.jetty.npn.NextProtoNego;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.spdy.api.Session;
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.spdy.client.SPDYClient;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Assert;
import org.junit.Ignore;

View File

@ -17,13 +17,14 @@
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.util.concurrent.Executor;
import org.eclipse.jetty.npn.NextProtoNego;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.spdy.api.server.ServerSessionFrameListener;
import org.eclipse.jetty.spdy.client.SPDYClient;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Before;

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.net.InetSocketAddress;
import java.util.concurrent.CountDownLatch;

View File

@ -17,7 +17,7 @@
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.nio.ByteBuffer;
import java.util.ArrayList;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.spdy;
package org.eclipse.jetty.spdy.server;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
@ -25,6 +25,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.io.MappedByteBufferPool;
import org.eclipse.jetty.spdy.StandardCompressionFactory;
import org.eclipse.jetty.spdy.api.SPDY;
import org.eclipse.jetty.spdy.api.Stream;
import org.eclipse.jetty.spdy.api.StreamFrameListener;