1 // 2 // ======================================================================== 3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. 4 // ------------------------------------------------------------------------ 5 // All rights reserved. This program and the accompanying materials 6 // are made available under the terms of the Eclipse Public License v1.0 7 // and Apache License v2.0 which accompanies this distribution. 8 // 9 // The Eclipse Public License is available at 10 // http://www.eclipse.org/legal/epl-v10.html 11 // 12 // The Apache License v2.0 is available at 13 // http://www.opensource.org/licenses/apache2.0.php 14 // 15 // You may elect to redistribute this code under either of these licenses. 16 // ======================================================================== 17 // 18 19 package org.eclipse.jetty.server; 20 21 22 import org.eclipse.jetty.io.Connection; 23 import org.eclipse.jetty.io.EndPoint; 24 25 /** 26 * <p>A Factory to create {@link Connection} instances for {@link Connector}s.</p> 27 * <p>A Connection factory is responsible for instantiating and configuring a {@link Connection} instance 28 * to handle an {@link EndPoint} accepted by a {@link Connector}.</p> 29 * <p> 30 * A ConnectionFactory has a protocol name that represents the protocol of the Connections 31 * created. Example of protocol names include:<dl> 32 * <dt>http</dt><dd>Creates a HTTP connection that can handle multiple versions of HTTP from 0.9 to 1.1</dd> 33 * <dt>spdy/2</dt><dd>Creates a HTTP connection that handles a specific version of the SPDY protocol</dd> 34 * <dt>SSL-XYZ</dt><dd>Create an SSL connection chained to a connection obtained from a connection factory 35 * with a protocol "XYZ".</dd> 36 * <dt>SSL-http</dt><dd>Create an SSL connection chained to a HTTP connection (aka https)</dd> 37 * <dt>SSL-npn</dt><dd>Create an SSL connection chained to a NPN connection, that uses a negotiation with 38 * the client to determine the next protocol.</dd> 39 * </dl> 40 */ 41 public interface ConnectionFactory 42 { 43 /* ------------------------------------------------------------ */ 44 /** 45 * @return A string representing the protocol name. 46 */ 47 public String getProtocol(); 48 49 /** 50 * <p>Creates a new {@link Connection} with the given parameters</p> 51 * @param connector The {@link Connector} creating this connection 52 * @param endPoint the {@link EndPoint} associated with the connection 53 * @return a new {@link Connection} 54 */ 55 public Connection newConnection(Connector connector, EndPoint endPoint); 56 57 }