Package org.eclipse.jetty.server
Class ProxyConnectionFactory.ProxyV2ConnectionFactory.ProxyProtocolV2Connection
- java.lang.Object
-
- org.eclipse.jetty.io.AbstractConnection
-
- org.eclipse.jetty.server.ProxyConnectionFactory.ProxyV2ConnectionFactory.ProxyProtocolV2Connection
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Connection
,Connection.UpgradeFrom
,Connection.UpgradeTo
- Enclosing class:
- ProxyConnectionFactory.ProxyV2ConnectionFactory
private class ProxyConnectionFactory.ProxyV2ConnectionFactory.ProxyProtocolV2Connection extends AbstractConnection implements Connection.UpgradeFrom, Connection.UpgradeTo
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteBuffer
_buffer
private Connector
_connector
private ProxyConnectionFactory.ProxyV2ConnectionFactory.Family
_family
private boolean
_headerParsed
private int
_length
private boolean
_local
private ConnectionFactory
_next
private static int
HEADER_LENGTH
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProxyProtocolV2Connection(EndPoint endp, Connector connector, ConnectionFactory next)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onFillable()
Callback method invoked when the endpoint is ready to be read.void
onOpen()
Callback method invoked when this connection is opened.java.nio.ByteBuffer
onUpgradeFrom()
Invoked during anupgrade
to produce a buffer containing bytes that have not been consumed by this connection, and that must be consumed by the upgrade-to connection.void
onUpgradeTo(java.nio.ByteBuffer buffer)
Invoked during anupgrade
to receive a buffer containing bytes that have not been consumed by the upgrade-from connection, and that must be consumed by this connection.private void
parseBodyAndUpgrade()
private void
parseHeader()
private void
releaseAndClose()
-
Methods inherited from class org.eclipse.jetty.io.AbstractConnection
addListener, close, failedCallback, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, getMessagesIn, getMessagesOut, isFillInterested, onClose, onFillInterestedFailed, onIdleExpired, onReadTimeout, removeListener, setInputBufferSize, toConnectionString, toString, tryFillInterested, tryFillInterested
-
-
-
-
Field Detail
-
HEADER_LENGTH
private static final int HEADER_LENGTH
- See Also:
- Constant Field Values
-
_connector
private final Connector _connector
-
_next
private final ConnectionFactory _next
-
_buffer
private final java.nio.ByteBuffer _buffer
-
_local
private boolean _local
-
_family
private ProxyConnectionFactory.ProxyV2ConnectionFactory.Family _family
-
_length
private int _length
-
_headerParsed
private boolean _headerParsed
-
-
Constructor Detail
-
ProxyProtocolV2Connection
protected ProxyProtocolV2Connection(EndPoint endp, Connector connector, ConnectionFactory next)
-
-
Method Detail
-
onUpgradeTo
public void onUpgradeTo(java.nio.ByteBuffer buffer)
Description copied from interface:Connection.UpgradeTo
Invoked during an
upgrade
to receive a buffer containing bytes that have not been consumed by the upgrade-from connection, and that must be consumed by this connection.- Specified by:
onUpgradeTo
in interfaceConnection.UpgradeTo
- Parameters:
buffer
- a non-null buffer of unconsumed bytes received from the upgrade-from connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes.
-
onOpen
public void onOpen()
Description copied from interface:Connection
Callback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
- Specified by:
onOpen
in interfaceConnection
- Overrides:
onOpen
in classAbstractConnection
-
onFillable
public void onFillable()
Description copied from class:AbstractConnection
Callback method invoked when the endpoint is ready to be read.
- Specified by:
onFillable
in classAbstractConnection
- See Also:
AbstractConnection.fillInterested()
-
onUpgradeFrom
public java.nio.ByteBuffer onUpgradeFrom()
Description copied from interface:Connection.UpgradeFrom
Invoked during an
upgrade
to produce a buffer containing bytes that have not been consumed by this connection, and that must be consumed by the upgrade-to connection.- Specified by:
onUpgradeFrom
in interfaceConnection.UpgradeFrom
- Returns:
- a buffer of unconsumed bytes to pass to the upgrade-to connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes. The returned buffer may be null if there are no unconsumed bytes.
-
parseBodyAndUpgrade
private void parseBodyAndUpgrade() throws java.io.IOException
- Throws:
java.io.IOException
-
parseHeader
private void parseHeader() throws java.io.IOException
- Throws:
java.io.IOException
-
releaseAndClose
private void releaseAndClose()
-
-