Top Description Inners Methods
org.eclipse.jetty.server

public Interface ConnectionFactory

Known Direct Subinterfaces
org.eclipse.jetty.server.ConnectionFactory.Upgrading, org.eclipse.jetty.server.ConnectionFactory.Detecting, org.eclipse.jetty.server.ConnectionFactory.Configuring
Known Direct Implementers
org.eclipse.jetty.server.AbstractConnectionFactory
Imports
java.nio.ByteBuffer, java.util.List, org.eclipse.jetty.http.BadMessageException, .HttpFields, .MetaData, org.eclipse.jetty.io.Connection, .EndPoint

A Factory to create Connection instances for Connectors.

A Connection factory is responsible for instantiating and configuring a Connection instance to handle an EndPoint accepted by a Connector.

A ConnectionFactory has a protocol name that represents the protocol of the Connections created. Example of protocol names include:

http
Creates an HTTP connection that can handle multiple versions of HTTP from 0.9 to 1.1
h2
Creates an HTTP/2 connection that handles the HTTP/2 protocol
SSL-XYZ
Create an SSL connection chained to a connection obtained from a connection factory with a protocol "XYZ".
SSL-http
Create an SSL connection chained to an HTTP connection (aka https)
SSL-ALPN
Create an SSL connection chained to a ALPN connection, that uses a negotiation with the client to determine the next protocol.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ConnectionFactory.Configuring

A ConnectionFactory that can configure the connector.

public static interface
ConnectionFactory.Detecting

Connections created by this factory MUST implement Connection.UpgradeTo.

public static interface

Method Summary

Modifier and TypeMethod and Description
public String
getProtocol()

Returns: A string representing the primary protocol name.

public List<String>
getProtocols()

Returns: A list of alternative protocol names/versions including the primary protocol.

public Connection

Returns:

a new Connection
newConnection
(Connector
The Connector creating this connection
connector
,
EndPoint
the EndPoint associated with the connection
endPoint
)

Creates a new Connection with the given parameters

Method Detail

getProtocolback to summary
public String getProtocol()
Returns:String

A string representing the primary protocol name.

getProtocolsback to summary
public List<String> getProtocols()
Returns:List<String>

A list of alternative protocol names/versions including the primary protocol.

newConnectionback to summary
public Connection newConnection(Connector connector, EndPoint endPoint)

Creates a new Connection with the given parameters

Parameters
connector:Connector

The Connector creating this connection

endPoint:EndPoint

the EndPoint associated with the connection

Returns:Connection

a new Connection

org.eclipse.jetty.server back to summary

public Interface ConnectionFactory.Configuring

extends ConnectionFactory
Known Direct Implementers
org.eclipse.jetty.server.SslConnectionFactory

A ConnectionFactory that can configure the connector.

Method Summary

Modifier and TypeMethod and Description
public void
configure(Connector
The connector to configure
connector
)

Called during Connector#start().

Inherited from org.eclipse.jetty.server.ConnectionFactory:
getProtocolgetProtocolsnewConnection

Method Detail

configureback to summary
public void configure(Connector connector)

Called during Connector#start().

Parameters
connector:Connector

The connector to configure

org.eclipse.jetty.server back to summary

public Interface ConnectionFactory.Detecting

extends ConnectionFactory
Known Direct Implementers
org.eclipse.jetty.server.ProxyConnectionFactory.ProxyV1ConnectionFactory, org.eclipse.jetty.server.ProxyConnectionFactory.ProxyV2ConnectionFactory, org.eclipse.jetty.server.SslConnectionFactory, org.eclipse.jetty.server.DetectorConnectionFactory

Connections created by this factory MUST implement Connection.UpgradeTo.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
ConnectionFactory.Detecting.Detection

The possible outcomes of the detect(ByteBuffer) method.

Method Summary

Modifier and TypeMethod and Description
public ConnectionFactory.Detecting.Detection

Returns:

One of:
detect
(ByteBuffer
the buffer.
buffer
)

Check the bytes in the given buffer to figure out if this Detecting instance can work with them or not.

Inherited from org.eclipse.jetty.server.ConnectionFactory:
getProtocolgetProtocolsnewConnection

Method Detail

detectback to summary
public ConnectionFactory.Detecting.Detection detect(ByteBuffer buffer)

Check the bytes in the given buffer to figure out if this Detecting instance can work with them or not.

The buffer MUST be left untouched by this method: bytes MUST NOT be consumed and MUST NOT be modified.

Parameters
buffer:ByteBuffer

the buffer.

Returns:ConnectionFactory.Detecting.Detection

One of:

org.eclipse.jetty.server back to summary

public final Enum ConnectionFactory.Detecting.Detection

extends Enum<ConnectionFactory.Detecting.Detection>
Class Inheritance

The possible outcomes of the detect(ByteBuffer) method.

Field Summary

Modifier and TypeField and Description
public static final ConnectionFactory.Detecting.Detection
NEED_MORE_BYTES

A Detecting requires more bytes to make a decision.

public static final ConnectionFactory.Detecting.Detection
NOT_RECOGNIZED

A Detecting cannot work with the given bytes.

public static final ConnectionFactory.Detecting.Detection
RECOGNIZED

A Detecting can work with the given bytes.

Constructor Summary

AccessConstructor and Description
private

Field Detail

NEED_MORE_BYTESback to summary
public static final ConnectionFactory.Detecting.Detection NEED_MORE_BYTES

A Detecting requires more bytes to make a decision.

NOT_RECOGNIZEDback to summary
public static final ConnectionFactory.Detecting.Detection NOT_RECOGNIZED

A Detecting cannot work with the given bytes.

RECOGNIZEDback to summary
public static final ConnectionFactory.Detecting.Detection RECOGNIZED

A Detecting can work with the given bytes.

Constructor Detail

Detectionback to summary
private Detection()

Method Detail

valueOfback to summary
public static ConnectionFactory.Detecting.Detection valueOf(String name)
valuesback to summary
public static ConnectionFactory.Detecting.Detection[] values()
org.eclipse.jetty.server back to summary

public Interface ConnectionFactory.Upgrading

extends ConnectionFactory

Method Summary

Modifier and TypeMethod and Description
public Connection

Returns:

Null to indicate that request processing should continue normally without upgrading. A new connection instance to indicate that the upgrade should proceed.
upgradeConnection
(Connector
The connector to upgrade for.
connector
,
EndPoint
The endpoint of the connection.
endPoint
,
MetaData.Request
The meta data of the upgrade request.
upgradeRequest
,
HttpFields.Mutable
The fields to be sent with the 101 response
responseFields
)

Create a connection for an upgrade request.

Inherited from org.eclipse.jetty.server.ConnectionFactory:
getProtocolgetProtocolsnewConnection

Method Detail

upgradeConnectionback to summary
public Connection upgradeConnection(Connector connector, EndPoint endPoint, MetaData.Request upgradeRequest, HttpFields.Mutable responseFields) throws BadMessageException

Create a connection for an upgrade request.

This is a variation of newConnection(Connector, EndPoint) that can create (and/or customise) a connection for an upgrade request. Implementations may call newConnection(Connector, EndPoint) or may construct the connection instance themselves.

Parameters
connector:Connector

The connector to upgrade for.

endPoint:EndPoint

The endpoint of the connection.

upgradeRequest:MetaData.Request

The meta data of the upgrade request.

responseFields:HttpFields.Mutable

The fields to be sent with the 101 response

Returns:Connection

Null to indicate that request processing should continue normally without upgrading. A new connection instance to indicate that the upgrade should proceed.

Exceptions
BadMessageException:
Thrown to indicate the upgrade attempt was illegal and that a bad message response should be sent.