public abstract class AbstractServerConnection extends ServerConnection
Modifier and Type | Class and Description |
---|---|
static class |
AbstractServerConnection.ConduitState |
ServerConnection.CloseListener
Modifier and Type | Field and Description |
---|---|
protected ByteBufferPool |
bufferPool |
protected StreamConnection |
channel |
protected List<ServerConnection.CloseListener> |
closeListeners |
protected io.undertow.server.AbstractServerConnection.CloseSetter |
closeSetter |
protected HttpServerExchange |
current |
protected PooledByteBuffer |
extraBytes
Any extra bytes that were read from the channel.
|
protected StreamSinkConduit |
originalSinkConduit |
protected StreamSourceConduit |
originalSourceConduit |
protected HttpHandler |
rootHandler |
protected OptionMap |
undertowOptions |
EMPTY
Constructor and Description |
---|
AbstractServerConnection(StreamConnection channel,
ByteBufferPool bufferPool,
HttpHandler rootHandler,
OptionMap undertowOptions,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
void |
addCloseListener(ServerConnection.CloseListener listener)
Adds a close listener, than will be invoked with the connection is closed
|
void |
clearChannel()
Resets the channel to its original state, effectively disabling all current conduit
wrappers.
|
void |
close()
Close this channel.
|
Pool<ByteBuffer> |
getBufferPool() |
int |
getBufferSize() |
ByteBufferPool |
getByteBufferPool()
Get the buffer pool for this connection.
|
StreamConnection |
getChannel()
Get the underlying channel.
|
ChannelListener.Setter<ServerConnection> |
getCloseSetter()
Get the setter which can be used to change the close listener for this channel.
|
PooledByteBuffer |
getExtraBytes() |
XnioIoThread |
getIoThread()
Get the I/O thread associated with this channel.
|
SocketAddress |
getLocalAddress()
Get the local address that this channel is bound to.
|
<A extends SocketAddress> |
getLocalAddress(Class<A> type)
Get the local address of a given type, or
null if the address is not of that
type. |
<T> T |
getOption(Option<T> option)
Get the value of a channel option.
|
StreamSinkConduit |
getOriginalSinkConduit() |
StreamSourceConduit |
getOriginalSourceConduit() |
SocketAddress |
getPeerAddress()
Returns the actual address of the remote connection.
|
<A extends SocketAddress> |
getPeerAddress(Class<A> type)
Returns the actual address of the remote connection.
|
HttpHandler |
getRootHandler()
Get the root HTTP handler for this connection.
|
protected ConduitStreamSinkChannel |
getSinkChannel() |
protected ConduitStreamSourceChannel |
getSourceChannel() |
OptionMap |
getUndertowOptions() |
XnioWorker |
getWorker()
Get the worker for this channel.
|
boolean |
isOpen() |
protected void |
maxEntitySizeUpdated(HttpServerExchange exchange)
Callback that is invoked if the max entity size is updated.
|
AbstractServerConnection.ConduitState |
resetChannel()
Resets the channel to its original state, effectively disabling all current conduit
wrappers.
|
void |
restoreChannel(AbstractServerConnection.ConduitState state)
Restores the channel conduits to a previous state.
|
void |
setExtraBytes(PooledByteBuffer extraBytes) |
<T> T |
setOption(Option<T> option,
T value)
Set an option for this channel.
|
protected void |
setUpgradeListener(HttpUpgradeListener upgradeListener) |
protected static StreamSinkConduit |
sink(AbstractServerConnection.ConduitState state) |
protected static StreamSourceConduit |
source(AbstractServerConnection.ConduitState state) |
boolean |
supportsOption(Option<?> option)
Determine whether an option is supported on this channel.
|
exchangeComplete, getSinkConduit, getSslSession, getSslSessionInfo, getTransportProtocol, isConnectSupported, isContinueResponseSupported, isPushSupported, isRequestTrailerFieldsSupported, isUpgradeSupported, pushResource, pushResource, sendOutOfBandResponse, setConnectListener, setSslSessionInfo, terminateRequestChannel, upgradeChannel
addToAttachmentList, createAttachmentMap, getAttachment, getAttachmentList, putAttachment, removeAttachment
protected final StreamConnection channel
protected final io.undertow.server.AbstractServerConnection.CloseSetter closeSetter
protected final ByteBufferPool bufferPool
protected final HttpHandler rootHandler
protected final OptionMap undertowOptions
protected final StreamSourceConduit originalSourceConduit
protected final StreamSinkConduit originalSinkConduit
protected final List<ServerConnection.CloseListener> closeListeners
protected HttpServerExchange current
protected PooledByteBuffer extraBytes
public AbstractServerConnection(StreamConnection channel, ByteBufferPool bufferPool, HttpHandler rootHandler, OptionMap undertowOptions, int bufferSize)
public Pool<ByteBuffer> getBufferPool()
getBufferPool
in class ServerConnection
public HttpHandler getRootHandler()
public ByteBufferPool getByteBufferPool()
getByteBufferPool
in class ServerConnection
public StreamConnection getChannel()
public ChannelListener.Setter<ServerConnection> getCloseSetter()
ConnectedChannel
public XnioWorker getWorker()
CloseableChannel
getWorker
in interface CloseableChannel
getWorker
in class ServerConnection
public XnioIoThread getIoThread()
CloseableChannel
getIoThread
in interface CloseableChannel
getIoThread
in class ServerConnection
public boolean isOpen()
isOpen
in interface Channel
isOpen
in class ServerConnection
public boolean supportsOption(Option<?> option)
Configurable
supportsOption
in interface Configurable
supportsOption
in class ServerConnection
option
- the optiontrue
if it is supportedpublic <T> T getOption(Option<T> option) throws IOException
Configurable
getOption
in interface Configurable
getOption
in class ServerConnection
T
- the type of the option valueoption
- the option to getnull
if it is not setIOException
- if an I/O error occurred when reading the optionpublic <T> T setOption(Option<T> option, T value) throws IllegalArgumentException, IOException
Configurable
setOption
in interface Configurable
setOption
in class ServerConnection
T
- the type of the option valueoption
- the option to setvalue
- the value of the option to setIllegalArgumentException
- if the value is not acceptable for this optionIOException
- if an I/O error occurred when modifying the optionpublic void close() throws IOException
CloseableChannel
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in interface InterruptibleChannel
close
in interface CloseableChannel
close
in class ServerConnection
IOException
- if the close failedpublic SocketAddress getPeerAddress()
ServerConnection
getPeerAddress
in interface ConnectedChannel
getPeerAddress
in class ServerConnection
public <A extends SocketAddress> A getPeerAddress(Class<A> type)
ServerConnection
getPeerAddress
in interface ConnectedChannel
getPeerAddress
in class ServerConnection
A
- The address typetype
- The type of address to returnpublic SocketAddress getLocalAddress()
BoundChannel
getLocalAddress
in interface BoundChannel
getLocalAddress
in class ServerConnection
public <A extends SocketAddress> A getLocalAddress(Class<A> type)
BoundChannel
null
if the address is not of that
type.getLocalAddress
in interface BoundChannel
getLocalAddress
in class ServerConnection
A
- the address typetype
- the address type classnull
if unknownpublic OptionMap getUndertowOptions()
getUndertowOptions
in class ServerConnection
public int getBufferSize()
getBufferSize
in class ServerConnection
public PooledByteBuffer getExtraBytes()
public void setExtraBytes(PooledByteBuffer extraBytes)
public StreamSourceConduit getOriginalSourceConduit()
public StreamSinkConduit getOriginalSinkConduit()
public AbstractServerConnection.ConduitState resetChannel()
AbstractServerConnection.ConduitState
object that
can be used the restore the channel.public void clearChannel()
public void restoreChannel(AbstractServerConnection.ConduitState state)
state
- The original stateresetChannel()
protected static StreamSinkConduit sink(AbstractServerConnection.ConduitState state)
protected static StreamSourceConduit source(AbstractServerConnection.ConduitState state)
public void addCloseListener(ServerConnection.CloseListener listener)
ServerConnection
addCloseListener
in class ServerConnection
listener
- The close listenerprotected ConduitStreamSinkChannel getSinkChannel()
getSinkChannel
in class ServerConnection
protected ConduitStreamSourceChannel getSourceChannel()
getSourceChannel
in class ServerConnection
protected void setUpgradeListener(HttpUpgradeListener upgradeListener)
setUpgradeListener
in class ServerConnection
protected void maxEntitySizeUpdated(HttpServerExchange exchange)
ServerConnection
maxEntitySizeUpdated
in class ServerConnection
exchange
- The current exchangeCopyright © 2019 JBoss by Red Hat. All rights reserved.