public abstract class AbstractServerConnection extends AbstractAttachable implements ServerConnection
Modifier and Type | Class and Description |
---|---|
static class |
AbstractServerConnection.ConduitState |
ServerConnection.CloseListener
Modifier and Type | Field and Description |
---|---|
protected org.xnio.Pool<ByteBuffer> |
bufferPool |
protected org.xnio.StreamConnection |
channel |
protected List<ServerConnection.CloseListener> |
closeListeners |
protected io.undertow.server.AbstractServerConnection.CloseSetter |
closeSetter |
protected org.xnio.Pooled<ByteBuffer> |
extraBytes
Any extra bytes that were read from the channel.
|
protected org.xnio.conduits.StreamSinkConduit |
originalSinkConduit |
protected org.xnio.conduits.StreamSourceConduit |
originalSourceConduit |
protected HttpHandler |
rootHandler |
protected org.xnio.OptionMap |
undertowOptions |
Constructor and Description |
---|
AbstractServerConnection(org.xnio.StreamConnection channel,
org.xnio.Pool<ByteBuffer> bufferPool,
HttpHandler rootHandler,
org.xnio.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 |
close() |
org.xnio.Pool<ByteBuffer> |
getBufferPool()
Get the buffer pool for this connection.
|
int |
getBufferSize() |
org.xnio.StreamConnection |
getChannel()
Get the underlying channel.
|
org.xnio.ChannelListener.Setter<ServerConnection> |
getCloseSetter() |
org.xnio.Pooled<ByteBuffer> |
getExtraBytes() |
org.xnio.XnioIoThread |
getIoThread() |
SocketAddress |
getLocalAddress() |
<A extends SocketAddress> |
getLocalAddress(Class<A> type) |
<T> T |
getOption(org.xnio.Option<T> option) |
org.xnio.conduits.StreamSinkConduit |
getOriginalSinkConduit() |
org.xnio.conduits.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.
|
org.xnio.conduits.ConduitStreamSinkChannel |
getSinkChannel() |
org.xnio.conduits.ConduitStreamSourceChannel |
getSourceChannel() |
org.xnio.OptionMap |
getUndertowOptions() |
org.xnio.XnioWorker |
getWorker() |
boolean |
isOpen() |
AbstractServerConnection.ConduitState |
resetChannel()
Resets the channel to its original state, effectively disabling all current conduit
wrappers.
|
void |
restoreChannel(AbstractServerConnection.ConduitState state)
Resores the channel conduits to a previous state.
|
void |
setExtraBytes(org.xnio.Pooled<ByteBuffer> extraBytes) |
<T> T |
setOption(org.xnio.Option<T> option,
T value) |
protected static org.xnio.conduits.StreamSinkConduit |
sink(AbstractServerConnection.ConduitState state) |
protected static org.xnio.conduits.StreamSourceConduit |
source(AbstractServerConnection.ConduitState state) |
boolean |
supportsOption(org.xnio.Option<?> option) |
addToAttachmentList, getAttachment, getAttachmentList, putAttachment, removeAttachment
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSslSessionInfo, sendOutOfBandResponse, setSslSessionInfo, upgradeChannel
addToAttachmentList, getAttachment, getAttachmentList, putAttachment, removeAttachment
protected final org.xnio.StreamConnection channel
protected final io.undertow.server.AbstractServerConnection.CloseSetter closeSetter
protected final org.xnio.Pool<ByteBuffer> bufferPool
protected final HttpHandler rootHandler
protected final org.xnio.OptionMap undertowOptions
protected final org.xnio.conduits.StreamSourceConduit originalSourceConduit
protected final org.xnio.conduits.StreamSinkConduit originalSinkConduit
protected final List<ServerConnection.CloseListener> closeListeners
protected org.xnio.Pooled<ByteBuffer> extraBytes
public AbstractServerConnection(org.xnio.StreamConnection channel, org.xnio.Pool<ByteBuffer> bufferPool, HttpHandler rootHandler, org.xnio.OptionMap undertowOptions, int bufferSize)
public HttpHandler getRootHandler()
public org.xnio.Pool<ByteBuffer> getBufferPool()
getBufferPool
in interface ServerConnection
public org.xnio.StreamConnection getChannel()
public org.xnio.ChannelListener.Setter<ServerConnection> getCloseSetter()
getCloseSetter
in interface org.xnio.channels.BoundChannel
getCloseSetter
in interface org.xnio.channels.CloseableChannel
getCloseSetter
in interface org.xnio.channels.ConnectedChannel
public org.xnio.XnioWorker getWorker()
getWorker
in interface ServerConnection
getWorker
in interface org.xnio.channels.CloseableChannel
public org.xnio.XnioIoThread getIoThread()
getIoThread
in interface ServerConnection
getIoThread
in interface org.xnio.channels.CloseableChannel
public boolean isOpen()
isOpen
in interface ServerConnection
isOpen
in interface Channel
public boolean supportsOption(org.xnio.Option<?> option)
supportsOption
in interface ServerConnection
supportsOption
in interface org.xnio.channels.Configurable
public <T> T getOption(org.xnio.Option<T> option) throws IOException
getOption
in interface ServerConnection
getOption
in interface org.xnio.channels.Configurable
IOException
public <T> T setOption(org.xnio.Option<T> option, T value) throws IllegalArgumentException, IOException
setOption
in interface ServerConnection
setOption
in interface org.xnio.channels.Configurable
IllegalArgumentException
IOException
public void close() throws IOException
close
in interface ServerConnection
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in interface InterruptibleChannel
close
in interface org.xnio.channels.CloseableChannel
IOException
public SocketAddress getPeerAddress()
ServerConnection
getPeerAddress
in interface ServerConnection
getPeerAddress
in interface org.xnio.channels.ConnectedChannel
public <A extends SocketAddress> A getPeerAddress(Class<A> type)
ServerConnection
getPeerAddress
in interface ServerConnection
getPeerAddress
in interface org.xnio.channels.ConnectedChannel
A
- The address typetype
- The type of address to returnpublic SocketAddress getLocalAddress()
getLocalAddress
in interface ServerConnection
getLocalAddress
in interface org.xnio.channels.BoundChannel
public <A extends SocketAddress> A getLocalAddress(Class<A> type)
getLocalAddress
in interface ServerConnection
getLocalAddress
in interface org.xnio.channels.BoundChannel
public org.xnio.OptionMap getUndertowOptions()
getUndertowOptions
in interface ServerConnection
public int getBufferSize()
getBufferSize
in interface ServerConnection
public org.xnio.Pooled<ByteBuffer> getExtraBytes()
public void setExtraBytes(org.xnio.Pooled<ByteBuffer> extraBytes)
public org.xnio.conduits.StreamSourceConduit getOriginalSourceConduit()
public org.xnio.conduits.StreamSinkConduit getOriginalSinkConduit()
public AbstractServerConnection.ConduitState resetChannel()
AbstractServerConnection.ConduitState
object that
can be used the restore the channel.public void restoreChannel(AbstractServerConnection.ConduitState state)
state
- The original stateresetChannel()
protected static org.xnio.conduits.StreamSinkConduit sink(AbstractServerConnection.ConduitState state)
protected static org.xnio.conduits.StreamSourceConduit source(AbstractServerConnection.ConduitState state)
public void addCloseListener(ServerConnection.CloseListener listener)
ServerConnection
addCloseListener
in interface ServerConnection
listener
- The close listenerpublic org.xnio.conduits.ConduitStreamSinkChannel getSinkChannel()
getSinkChannel
in interface ServerConnection
public org.xnio.conduits.ConduitStreamSourceChannel getSourceChannel()
getSourceChannel
in interface ServerConnection
Copyright © 2013 JBoss by Red Hat. All rights reserved.