Class ProxyConnectionFactory.ProxyEndPoint
- All Implemented Interfaces:
Closeable
,AutoCloseable
,EndPoint
,EndPoint.Wrapper
,Attributes
,Dumpable
- Enclosing class:
- ProxyConnectionFactory
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Attributes
Attributes.Wrapper
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.EndPoint
EndPoint.Wrapper
-
Field Summary
-
Constructor Summary
ConstructorDescriptionProxyEndPoint
(EndPoint endPoint, InetSocketAddress remote, InetSocketAddress local) Deprecated.ProxyEndPoint
(EndPoint endPoint, SocketAddress local, SocketAddress remote) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Close any backing stream associated with the endpoint, passing a causeint
fill
(ByteBuffer buffer) Fill the passed buffer with data from this endpoint.void
fillInterested
(Callback callback) Requests callback methods to be invoked when a call toEndPoint.fill(ByteBuffer)
would return data or EOF.boolean
flush
(ByteBuffer... buffer) Flush data from the passed header/buffer to this endpoint.long
long
Get the max idle time in ms.byte[]
getTLV
(int type) Gets a TLV vector, see section 2.2.7 of the PROXY protocol specification.boolean
boolean
Test if the input is shutdown.boolean
isOpen()
boolean
Test if output is shutdown.void
Callback method invoked when thisEndPoint
is closed.void
onOpen()
Callback method invoked when this EndPoint is opened.void
setConnection
(Connection connection) void
setIdleTimeout
(long idleTimeout) Set the idle timeout.void
Shutdown the output.toString()
boolean
tryFillInterested
(Callback callback) Requests callback methods to be invoked when a call toEndPoint.fill(ByteBuffer)
would return data or EOF.unwrap()
void
upgrade
(Connection newConnection) Upgrades this EndPoint from the current connection to the given new connection.void
write
(Callback callback, ByteBuffer... buffers) Writes the given buffers viaEndPoint.flush(ByteBuffer...)
and invokes callback methods when either all the data has been flushed or an error occurs.Methods inherited from class org.eclipse.jetty.util.AttributesMap
addAll, clearAttributes, dump, dump, getAttribute, getAttributeEntrySet, getAttributeNames, getAttributeNamesCopy, getAttributeNameSet, removeAttribute, setAttribute, size
-
Constructor Details
-
ProxyEndPoint
@Deprecated public ProxyEndPoint(EndPoint endPoint, InetSocketAddress remote, InetSocketAddress local) Deprecated. -
ProxyEndPoint
-
-
Method Details
-
unwrap
- Specified by:
unwrap
in interfaceEndPoint.Wrapper
- Returns:
- The wrapped
EndPoint
-
getTLV
public byte[] getTLV(int type) Gets a TLV vector, see section 2.2.7 of the PROXY protocol specification.
- Parameters:
type
- the TLV type- Returns:
- the TLV value or null if not present.
-
close
Description copied from interface:EndPoint
Close any backing stream associated with the endpoint, passing a cause -
fill
Description copied from interface:EndPoint
Fill the passed buffer with data from this endpoint. The bytes are appended to any data already in the buffer by writing from the buffers limit up to it's capacity. The limit is updated to include the filled bytes.- Specified by:
fill
in interfaceEndPoint
- Parameters:
buffer
- The buffer to fill. The position and limit are modified during the fill. After the operation, the position is unchanged and the limit is increased to reflect the new data filled.- Returns:
- an
int
value indicating the number of bytes filled or -1 if EOF is read or the input is shutdown. - Throws:
IOException
- if the endpoint is closed.
-
fillInterested
Description copied from interface:EndPoint
Requests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer)
would return data or EOF.- Specified by:
fillInterested
in interfaceEndPoint
- Parameters:
callback
- the callback to call when an error occurs or we are readable. The callback may implement theInvocable
interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.- Throws:
ReadPendingException
- if another read operation is concurrent.
-
flush
Description copied from interface:EndPoint
Flush data from the passed header/buffer to this endpoint. As many bytes as can be consumed are taken from the header/buffer position up until the buffer limit. The header/buffers position is updated to indicate how many bytes have been consumed.- Specified by:
flush
in interfaceEndPoint
- Parameters:
buffer
- the buffers to flush- Returns:
- True IFF all the buffers have been consumed and the endpoint has flushed the data to its destination (ie is not buffering any data).
- Throws:
IOException
- If the endpoint is closed or output is shutdown.
-
getConnection
- Specified by:
getConnection
in interfaceEndPoint
- Returns:
- the
Connection
associated with this EndPoint - See Also:
-
setConnection
- Specified by:
setConnection
in interfaceEndPoint
- Parameters:
connection
- theConnection
associated with this EndPoint- See Also:
-
getCreatedTimeStamp
public long getCreatedTimeStamp()- Specified by:
getCreatedTimeStamp
in interfaceEndPoint
- Returns:
- the epoch time in milliseconds when this EndPoint was created
-
getIdleTimeout
public long getIdleTimeout()Description copied from interface:EndPoint
Get the max idle time in ms.The max idle time is the time the endpoint can be idle before extraordinary handling takes place.
- Specified by:
getIdleTimeout
in interfaceEndPoint
- Returns:
- the max idle time in ms or if ms <= 0 implies an infinite timeout
-
setIdleTimeout
public void setIdleTimeout(long idleTimeout) Description copied from interface:EndPoint
Set the idle timeout.- Specified by:
setIdleTimeout
in interfaceEndPoint
- Parameters:
idleTimeout
- the idle timeout in MS. Timeout <= 0 implies an infinite timeout
-
getLocalAddress
- Specified by:
getLocalAddress
in interfaceEndPoint
- Returns:
- The local InetSocketAddress to which this
EndPoint
is bound, ornull
if thisEndPoint
is not bound to a Socket address.
-
getLocalSocketAddress
- Specified by:
getLocalSocketAddress
in interfaceEndPoint
- Returns:
- the local SocketAddress to which this
EndPoint
is bound ornull
if thisEndPoint
is not bound to a Socket address.
-
getRemoteAddress
- Specified by:
getRemoteAddress
in interfaceEndPoint
- Returns:
- The remote InetSocketAddress to which this
EndPoint
is connected, ornull
if thisEndPoint
is not connected to a Socket address.
-
getRemoteSocketAddress
- Specified by:
getRemoteSocketAddress
in interfaceEndPoint
- Returns:
- The remote SocketAddress to which this
EndPoint
is connected, ornull
if thisEndPoint
is not connected to a Socket address.
-
getTransport
- Specified by:
getTransport
in interfaceEndPoint
- Returns:
- The underlying transport object (socket, channel, etc.)
-
isFillInterested
public boolean isFillInterested()- Specified by:
isFillInterested
in interfaceEndPoint
- Returns:
- whether
EndPoint.fillInterested(Callback)
has been called, butEndPoint.fill(ByteBuffer)
has not yet been called
-
isInputShutdown
public boolean isInputShutdown()Description copied from interface:EndPoint
Test if the input is shutdown. The input is shutdown if an EOF has been read while doing aEndPoint.fill(ByteBuffer)
. Once the input is shutdown, all calls toEndPoint.fill(ByteBuffer)
will return -1, until such time as the end point is close, when they will returnEofException
.- Specified by:
isInputShutdown
in interfaceEndPoint
- Returns:
- True if the input is shutdown or the endpoint is closed.
-
isOpen
public boolean isOpen() -
isOutputShutdown
public boolean isOutputShutdown()Description copied from interface:EndPoint
Test if output is shutdown. The output is shutdown by a call toEndPoint.shutdownOutput()
orEndPoint.close()
.- Specified by:
isOutputShutdown
in interfaceEndPoint
- Returns:
- true if the output is shutdown or the endpoint is closed.
-
onClose
Description copied from interface:EndPoint
Callback method invoked when this
EndPoint
is closed. -
onOpen
public void onOpen()Description copied from interface:EndPoint
Callback method invoked when this EndPoint is opened.
-
shutdownOutput
public void shutdownOutput()Description copied from interface:EndPoint
Shutdown the output.This call indicates that no more data will be sent on this endpoint that that the remote end should read an EOF once all previously sent data has been consumed. Shutdown may be done either at the TCP/IP level, as a protocol exchange (Eg TLS close handshake) or both.
If the endpoint has
EndPoint.isInputShutdown()
true, then this call has the same effect asEndPoint.close()
.- Specified by:
shutdownOutput
in interfaceEndPoint
-
toString
- Overrides:
toString
in classAttributesMap
-
tryFillInterested
Description copied from interface:EndPoint
Requests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer)
would return data or EOF.- Specified by:
tryFillInterested
in interfaceEndPoint
- Parameters:
callback
- the callback to call when an error occurs or we are readable. The callback may implement theInvocable
interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.- Returns:
- true if set
-
upgrade
Description copied from interface:EndPoint
Upgrades this EndPoint from the current connection to the given new connection.
Closes the current connection, links this EndPoint to the new connection and then opens the new connection.
If the current connection is an instance of
Connection.UpgradeFrom
then a buffer of unconsumed bytes is requested. If the buffer of unconsumed bytes is non-null and non-empty, then the new connection is tested: if it is an instance ofConnection.UpgradeTo
, then the unconsumed buffer is passed to the new connection; otherwise, an exception is thrown since there are unconsumed bytes that cannot be consumed by the new connection. -
write
Description copied from interface:EndPoint
Writes the given buffers via
EndPoint.flush(ByteBuffer...)
and invokes callback methods when either all the data has been flushed or an error occurs.- Specified by:
write
in interfaceEndPoint
- Parameters:
callback
- the callback to call when an error occurs or the write completed. The callback may implement theInvocable
interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.buffers
- one or moreByteBuffer
s that will be flushed.- Throws:
WritePendingException
- if another write operation is concurrent.
-