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, getSslSessionInfo, getTransportProtocol, isConnectSupported, isContinueResponseSupported, isPushSupported, isUpgradeSupported, pushResource, pushResource, sendOutOfBandResponse, setConnectListener, setSslSessionInfo, terminateRequestChannel, upgradeChanneladdToAttachmentList, createAttachmentMap, getAttachment, getAttachmentList, putAttachment, removeAttachmentprotected 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 ServerConnectionpublic HttpHandler getRootHandler()
public ByteBufferPool getByteBufferPool()
getByteBufferPool in class ServerConnectionpublic StreamConnection getChannel()
public ChannelListener.Setter<ServerConnection> getCloseSetter()
ConnectedChannelpublic XnioWorker getWorker()
CloseableChannelgetWorker in interface CloseableChannelgetWorker in class ServerConnectionpublic XnioIoThread getIoThread()
CloseableChannelgetIoThread in interface CloseableChannelgetIoThread in class ServerConnectionpublic boolean isOpen()
isOpen in interface ChannelisOpen in class ServerConnectionpublic boolean supportsOption(Option<?> option)
ConfigurablesupportsOption in interface ConfigurablesupportsOption in class ServerConnectionoption - the optiontrue if it is supportedpublic <T> T getOption(Option<T> option) throws IOException
ConfigurablegetOption in interface ConfigurablegetOption in class ServerConnectionT - 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
ConfigurablesetOption in interface ConfigurablesetOption in class ServerConnectionT - 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
CloseableChannelclose in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in interface InterruptibleChannelclose in interface CloseableChannelclose in class ServerConnectionIOException - if the close failedpublic SocketAddress getPeerAddress()
ServerConnectiongetPeerAddress in interface ConnectedChannelgetPeerAddress in class ServerConnectionpublic <A extends SocketAddress> A getPeerAddress(Class<A> type)
ServerConnectiongetPeerAddress in interface ConnectedChannelgetPeerAddress in class ServerConnectionA - The address typetype - The type of address to returnpublic SocketAddress getLocalAddress()
BoundChannelgetLocalAddress in interface BoundChannelgetLocalAddress in class ServerConnectionpublic <A extends SocketAddress> A getLocalAddress(Class<A> type)
BoundChannelnull if the address is not of that
type.getLocalAddress in interface BoundChannelgetLocalAddress in class ServerConnectionA - the address typetype - the address type classnull if unknownpublic OptionMap getUndertowOptions()
getUndertowOptions in class ServerConnectionpublic int getBufferSize()
getBufferSize in class ServerConnectionpublic 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)
ServerConnectionaddCloseListener in class ServerConnectionlistener - The close listenerprotected ConduitStreamSinkChannel getSinkChannel()
getSinkChannel in class ServerConnectionprotected ConduitStreamSourceChannel getSourceChannel()
getSourceChannel in class ServerConnectionprotected void setUpgradeListener(HttpUpgradeListener upgradeListener)
setUpgradeListener in class ServerConnectionprotected void maxEntitySizeUpdated(HttpServerExchange exchange)
ServerConnectionmaxEntitySizeUpdated in class ServerConnectionexchange - The current exchangeCopyright © 2016 JBoss by Red Hat. All rights reserved.