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.proxy;
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.spdy.SPDYServerConnector;
22  import org.eclipse.jetty.spdy.http.ServerHTTPAsyncConnectionFactory;
23  
24  public class ProxyHTTPAsyncConnectionFactory extends ServerHTTPAsyncConnectionFactory
25  {
26      private final short version;
27      private final ProxyEngineSelector proxyEngineSelector;
28  
29      public ProxyHTTPAsyncConnectionFactory(SPDYServerConnector connector, short version, ProxyEngineSelector proxyEngineSelector)
30      {
31          super(connector);
32          this.version = version;
33          this.proxyEngineSelector = proxyEngineSelector;
34      }
35  
36      @Override
37      public AsyncConnection newAsyncConnection(SocketChannel channel, AsyncEndPoint endPoint, Object attachment)
38      {
39          return new ProxyHTTPSPDYAsyncConnection(getConnector(), endPoint, version, proxyEngineSelector);
40      }
41  }