View Javadoc

1   //========================================================================
2   //Copyright 2011-2012 Mort Bay Consulting Pty. Ltd.
3   //------------------------------------------------------------------------
4   //All rights reserved. This program and the accompanying materials
5   //are made available under the terms of the Eclipse Public License v1.0
6   //and Apache License v2.0 which accompanies this distribution.
7   //The Eclipse Public License is available at
8   //http://www.eclipse.org/legal/epl-v10.html
9   //The Apache License v2.0 is available at
10  //http://www.opensource.org/licenses/apache2.0.php
11  //You may elect to redistribute this code under either of these licenses.
12  //========================================================================
13  
14  
15  package org.eclipse.jetty.spdy.http;
16  
17  import java.nio.channels.SocketChannel;
18  
19  import org.eclipse.jetty.io.AsyncEndPoint;
20  import org.eclipse.jetty.io.nio.AsyncConnection;
21  import org.eclipse.jetty.server.AsyncHttpConnection;
22  import org.eclipse.jetty.spdy.AsyncConnectionFactory;
23  import org.eclipse.jetty.spdy.SPDYServerConnector;
24  
25  public class ServerHTTPAsyncConnectionFactory implements AsyncConnectionFactory
26  {
27      private final SPDYServerConnector connector;
28  
29      public ServerHTTPAsyncConnectionFactory(SPDYServerConnector connector)
30      {
31          this.connector = connector;
32      }
33  
34      public SPDYServerConnector getConnector()
35      {
36          return connector;
37      }
38  
39      @Override
40      public AsyncConnection newAsyncConnection(SocketChannel channel, AsyncEndPoint endPoint, Object attachment)
41      {
42          return new AsyncHttpConnection(connector, endPoint, connector.getServer());
43      }
44  }