Top Inners Fields Constructors Methods
io.undertow.server

public abstract Class AbstractServerConnection

extends ServerConnection
Class Inheritance
Known Direct Subclasses
io.undertow.server.protocol.ajp.AjpServerConnection, io.undertow.server.protocol.http.HttpServerConnection
Imports
io.undertow.UndertowLogger, .UndertowMessages, org.xnio.ChannelListener, .ChannelListeners, .Option, .OptionMap, .Pool, .StreamConnection, .XnioIoThread, .XnioWorker, io.undertow.connector.ByteBufferPool, .PooledByteBuffer, org.xnio.conduits.ConduitStreamSinkChannel, .ConduitStreamSourceChannel, .StreamSinkConduit, .StreamSourceConduit, java.io.IOException, java.net.SocketAddress, java.nio.ByteBuffer, java.util.LinkedList, .List

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
public static class

Field Summary

Modifier and TypeField and Description
protected final ByteBufferPool
private final int
protected final StreamConnection
protected final List<ServerConnection.CloseListener>
protected final AbstractServerConnection.CloseSetter
protected HttpServerExchange
protected PooledByteBuffer
extraBytes

Any extra bytes that were read from the channel.

protected final StreamSinkConduit
protected final StreamSourceConduit
private XnioBufferPoolAdaptor
poolAdaptor

References Deprecated XnioBufferPoolAdaptor is deprecated or references (maybe indirectly) at least one deprecated element.
protected final HttpHandler
protected final OptionMap

Constructor Summary

AccessConstructor and Description
public
AbstractServerConnection(StreamConnection channel, final ByteBufferPool bufferPool, final HttpHandler rootHandler, final OptionMap undertowOptions, final int bufferSize)

Method Summary

Modifier and TypeMethod and Description
public void
addCloseListener(ServerConnection.CloseListener
The close listener
listener
)

Implements abstract io.undertow.server.ServerConnection.addCloseListener.

Adds a close listener, than will be invoked with the connection is closed

public void
clearChannel()

Resets the channel to its original state, effectively disabling all current conduit wrappers.

public void
public Pool<ByteBuffer>
getBufferPool()

Implements abstract io.undertow.server.ServerConnection.getBufferPool.

References Deprecated Pool is deprecated or references (maybe indirectly) at least one deprecated element.

public int

Returns:

The size of the buffers allocated by the buffer pool
getBufferSize
()

Implements abstract io.undertow.server.ServerConnection.getBufferSize.

public ByteBufferPool

Returns:

the buffer pool for this connection
getByteBufferPool
()

Implements abstract io.undertow.server.ServerConnection.getByteBufferPool.

Get the buffer pool for this connection.

public StreamConnection

Returns:

the underlying channel
getChannel
()

Get the underlying channel.

public ChannelListener.Setter<ServerConnection>
getCloseSetter()

Implements org.xnio.channels.ConnectedChannel.getCloseSetter.

Get the setter which can be used to change the close listener for this channel.

public PooledByteBuffer
public XnioIoThread
getIoThread()

Implements abstract io.undertow.server.ServerConnection.getIoThread.

Implements org.xnio.channels.CloseableChannel.getIoThread.

Get the I/O thread associated with this channel.

public SocketAddress
getLocalAddress()

Implements abstract io.undertow.server.ServerConnection.getLocalAddress.

Implements org.xnio.channels.BoundChannel.getLocalAddress.

Get the local address that this channel is bound to.

public <A extends SocketAddress> A
getLocalAddress(final Class<A>
the address type class
type
)

Implements abstract io.undertow.server.ServerConnection.getLocalAddress.

Implements org.xnio.channels.BoundChannel.getLocalAddress.

Get the local address of a given type, or null if the address is not of that type.

public <T> T
getOption(final Option<T>
the option to get
option
)

Implements abstract io.undertow.server.ServerConnection.getOption.

Implements org.xnio.channels.Configurable.getOption.

Get the value of a channel option.

public StreamSinkConduit

Returns:

The original underlying sink conduit
getOriginalSinkConduit
()

public StreamSourceConduit

Returns:

The original source conduit
getOriginalSourceConduit
()

public SocketAddress
getPeerAddress()

Implements abstract io.undertow.server.ServerConnection.getPeerAddress.

Implements org.xnio.channels.ConnectedChannel.getPeerAddress.

Returns the actual address of the remote connection.

public <A extends SocketAddress> A
getPeerAddress(final Class<A>
The type of address to return
type
)

Implements abstract io.undertow.server.ServerConnection.getPeerAddress.

Implements org.xnio.channels.ConnectedChannel.getPeerAddress.

Returns the actual address of the remote connection.

public HttpHandler

Returns:

the root HTTP handler for this connection
getRootHandler
()

Get the root HTTP handler for this connection.

protected ConduitStreamSinkChannel
protected ConduitStreamSourceChannel
public OptionMap
public XnioWorker
getWorker()

Implements abstract io.undertow.server.ServerConnection.getWorker.

Implements org.xnio.channels.CloseableChannel.getWorker.

Get the worker for this channel.

public boolean
isOpen()

Implements abstract io.undertow.server.ServerConnection.isOpen.

Implements java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

protected void
maxEntitySizeUpdated(HttpServerExchange
The current exchange
exchange
)

Implements abstract io.undertow.server.ServerConnection.maxEntitySizeUpdated.

Callback that is invoked if the max entity size is updated.

public AbstractServerConnection.ConduitState

Returns:

An opaque representation of the previous channel state
resetChannel
()

Resets the channel to its original state, effectively disabling all current conduit wrappers.

public void
restoreChannel(final AbstractServerConnection.ConduitState
The original state
state
)

Restores the channel conduits to a previous state.

public void
setExtraBytes(final PooledByteBuffer extraBytes)

public <T> T
setOption(final Option<T>
the option to set
option
,
final T
the value of the option to set
value
)

Implements abstract io.undertow.server.ServerConnection.setOption.

Implements org.xnio.channels.Configurable.setOption.

Set an option for this channel.

protected void
protected static StreamSinkConduit
protected static StreamSourceConduit
public boolean
supportsOption(final Option<?>
the option
option
)

Implements abstract io.undertow.server.ServerConnection.supportsOption.

Implements org.xnio.channels.Configurable.supportsOption.

Determine whether an option is supported on this channel.

Inherited from io.undertow.server.ServerConnection:
exchangeCompletegetIdgetProtocolRequestIdgetSinkConduitgetSslSessiongetSslSessionInfogetTransportProtocolisConnectSupportedisContinueResponseSupportedisPushSupportedisRequestTrailerFieldsSupportedisUpgradeSupportedpushResourcepushResourcesendOutOfBandResponsesetConnectListenersetSslSessionInfoterminateRequestChannelupgradeChannel

Field Detail

bufferPoolback to summary
protected final ByteBufferPool bufferPool
bufferSizeback to summary
private final int bufferSize
channelback to summary
protected final StreamConnection channel
closeListenersback to summary
protected final List<ServerConnection.CloseListener> closeListeners
closeSetterback to summary
protected final AbstractServerConnection.CloseSetter closeSetter
currentback to summary
protected HttpServerExchange current
extraBytesback to summary
protected PooledByteBuffer extraBytes

Any extra bytes that were read from the channel. This could be data for this requests, or the next response.

originalSinkConduitback to summary
protected final StreamSinkConduit originalSinkConduit
originalSourceConduitback to summary
protected final StreamSourceConduit originalSourceConduit
poolAdaptorback to summary
private XnioBufferPoolAdaptor poolAdaptor

References Deprecated

XnioBufferPoolAdaptor is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

rootHandlerback to summary
protected final HttpHandler rootHandler
undertowOptionsback to summary
protected final OptionMap undertowOptions

Constructor Detail

AbstractServerConnectionback to summary
public AbstractServerConnection(StreamConnection channel, final ByteBufferPool bufferPool, final HttpHandler rootHandler, final OptionMap undertowOptions, final int bufferSize)

Method Detail

addCloseListenerback to summary
public void addCloseListener(ServerConnection.CloseListener listener)

Implements abstract io.undertow.server.ServerConnection.addCloseListener.

Doc from io.undertow.server.ServerConnection.addCloseListener.

Adds a close listener, than will be invoked with the connection is closed

Parameters
listener:ServerConnection.CloseListener

The close listener

Annotations
@Override
clearChannelback to summary
public void clearChannel()

Resets the channel to its original state, effectively disabling all current conduit wrappers. The current state is lost.

closeback to summary
public void close() throws IOException

Implements abstract io.undertow.server.ServerConnection.close.

Implements org.xnio.channels.CloseableChannel.close.

Doc from org.xnio.channels.CloseableChannel.close.

Close this channel. When a channel is closed, its close listener is invoked. Invoking this method more than once has no additional effect.

Annotations
@Override
Exceptions
IOException:
if the close failed
getBufferPoolback to summary
public Pool<ByteBuffer> getBufferPool()

Implements abstract io.undertow.server.ServerConnection.getBufferPool.

References Deprecated

Pool is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns:Pool<ByteBuffer>

Doc from io.undertow.server.ServerConnection.getBufferPool.

The connections buffer pool

Annotations
@Override
getBufferSizeback to summary
public int getBufferSize()

Implements abstract io.undertow.server.ServerConnection.getBufferSize.

Returns:int

The size of the buffers allocated by the buffer pool

Annotations
@Override
getByteBufferPoolback to summary
public ByteBufferPool getByteBufferPool()

Implements abstract io.undertow.server.ServerConnection.getByteBufferPool.

Get the buffer pool for this connection.

Returns:ByteBufferPool

the buffer pool for this connection

Annotations
@Override
getChannelback to summary
public StreamConnection getChannel()

Get the underlying channel.

Returns:StreamConnection

the underlying channel

getCloseSetterback to summary
public ChannelListener.Setter<ServerConnection> getCloseSetter()

Implements org.xnio.channels.ConnectedChannel.getCloseSetter.

Doc from org.xnio.channels.ConnectedChannel.getCloseSetter.

Get the setter which can be used to change the close listener for this channel. If the channel is already closed, then the listener will not be called.

Returns:ChannelListener.Setter<ServerConnection>

Doc from org.xnio.channels.CloseableChannel.getCloseSetter.

the setter

Annotations
@Override
getExtraBytesback to summary
public PooledByteBuffer getExtraBytes()
getIoThreadback to summary
public XnioIoThread getIoThread()

Implements abstract io.undertow.server.ServerConnection.getIoThread.

Implements org.xnio.channels.CloseableChannel.getIoThread.

Doc from org.xnio.channels.CloseableChannel.getIoThread.

Get the I/O thread associated with this channel.

Returns:XnioIoThread

Doc from io.undertow.server.ServerConnection.getIoThread.

The IO thread associated with the connection

Annotations
@Override
getLocalAddressback to summary
public SocketAddress getLocalAddress()

Implements abstract io.undertow.server.ServerConnection.getLocalAddress.

Implements org.xnio.channels.BoundChannel.getLocalAddress.

Doc from org.xnio.channels.BoundChannel.getLocalAddress.

Get the local address that this channel is bound to.

Returns:SocketAddress

the local address

Annotations
@Override
getLocalAddressback to summary
public <A extends SocketAddress> A getLocalAddress(final Class<A> type)

Implements abstract io.undertow.server.ServerConnection.getLocalAddress.

Implements org.xnio.channels.BoundChannel.getLocalAddress.

Doc from org.xnio.channels.BoundChannel.getLocalAddress.

Get the local address of a given type, or null if the address is not of that type.

Parameters
<A>
the address type
type:Class<A>

the address type class

Returns:A

the local address, or null if unknown

Annotations
@Override
getOptionback to summary
public <T> T getOption(final Option<T> option) throws IOException

Implements abstract io.undertow.server.ServerConnection.getOption.

Implements org.xnio.channels.Configurable.getOption.

Doc from org.xnio.channels.Configurable.getOption.

Get the value of a channel option.

Parameters
<T>
the type of the option value
option:Option<T>

the option to get

Returns:T

the value of the option, or null if it is not set

Annotations
@Override
Exceptions
IOException:
if an I/O error occurred when reading the option
getOriginalSinkConduitback to summary
public StreamSinkConduit getOriginalSinkConduit()
Returns:StreamSinkConduit

The original underlying sink conduit

getOriginalSourceConduitback to summary
public StreamSourceConduit getOriginalSourceConduit()
Returns:StreamSourceConduit

The original source conduit

getPeerAddressback to summary
public SocketAddress getPeerAddress()

Implements abstract io.undertow.server.ServerConnection.getPeerAddress.

Implements org.xnio.channels.ConnectedChannel.getPeerAddress.

Doc from io.undertow.server.ServerConnection.getPeerAddress.

Returns the actual address of the remote connection. This will not take things like X-Forwarded-for into account.

Returns:SocketAddress

The address of the remote peer

Annotations
@Override
getPeerAddressback to summary
public <A extends SocketAddress> A getPeerAddress(final Class<A> type)

Implements abstract io.undertow.server.ServerConnection.getPeerAddress.

Implements org.xnio.channels.ConnectedChannel.getPeerAddress.

Doc from io.undertow.server.ServerConnection.getPeerAddress.

Returns the actual address of the remote connection. This will not take things like X-Forwarded-for into account.

Parameters
<A>
The address type
type:Class<A>

The type of address to return

Returns:A

The remote endpoint address

Annotations
@Override
getRootHandlerback to summary
public HttpHandler getRootHandler()

Get the root HTTP handler for this connection.

Returns:HttpHandler

the root HTTP handler for this connection

getSinkChannelback to summary
protected ConduitStreamSinkChannel getSinkChannel()

Implements abstract io.undertow.server.ServerConnection.getSinkChannel.

Annotations
@Override
getSourceChannelback to summary
protected ConduitStreamSourceChannel getSourceChannel()

Implements abstract io.undertow.server.ServerConnection.getSourceChannel.

Annotations
@Override
getUndertowOptionsback to summary
public OptionMap getUndertowOptions()

Implements abstract io.undertow.server.ServerConnection.getUndertowOptions.

Annotations
@Override
getWorkerback to summary
public XnioWorker getWorker()

Implements abstract io.undertow.server.ServerConnection.getWorker.

Implements org.xnio.channels.CloseableChannel.getWorker.

Doc from org.xnio.channels.CloseableChannel.getWorker.

Get the worker for this channel.

Returns:XnioWorker

Doc from io.undertow.server.ServerConnection.getWorker.

The connections worker

Annotations
@Override
isOpenback to summary
public boolean isOpen()

Implements abstract io.undertow.server.ServerConnection.isOpen.

Implements java.nio.channels.Channel.isOpen.

Doc from java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

Returns:boolean

Doc from io.undertow.server.ServerConnection.isOpen.

true if the connection is open

Annotations
@Override
maxEntitySizeUpdatedback to summary
protected void maxEntitySizeUpdated(HttpServerExchange exchange)

Implements abstract io.undertow.server.ServerConnection.maxEntitySizeUpdated.

Doc from io.undertow.server.ServerConnection.maxEntitySizeUpdated.

Callback that is invoked if the max entity size is updated.

Parameters
exchange:HttpServerExchange

The current exchange

Annotations
@Override
resetChannelback to summary
public AbstractServerConnection.ConduitState resetChannel()

Resets the channel to its original state, effectively disabling all current conduit wrappers. The current state is encapsulated inside a ConduitState object that can be used the restore the channel.

Returns:AbstractServerConnection.ConduitState

An opaque representation of the previous channel state

restoreChannelback to summary
public void restoreChannel(final AbstractServerConnection.ConduitState state)

Restores the channel conduits to a previous state.

Parameters
state:AbstractServerConnection.ConduitState

The original state

See Also
resetChannel()
setExtraBytesback to summary
public void setExtraBytes(final PooledByteBuffer extraBytes)
setOptionback to summary
public <T> T setOption(final Option<T> option, final T value) throws IllegalArgumentException, IOException

Implements abstract io.undertow.server.ServerConnection.setOption.

Implements org.xnio.channels.Configurable.setOption.

Doc from org.xnio.channels.Configurable.setOption.

Set an option for this channel. Unsupported options are ignored.

Parameters
<T>
the type of the option value
option:Option<T>

the option to set

value:T

the value of the option to set

Returns:T

the previous option value, if any

Annotations
@Override
Exceptions
IllegalArgumentException:
if the value is not acceptable for this option
IOException:
if an I/O error occurred when modifying the option
setUpgradeListenerback to summary
protected void setUpgradeListener(HttpUpgradeListener upgradeListener)

Implements abstract io.undertow.server.ServerConnection.setUpgradeListener.

sinkback to summary
protected static StreamSinkConduit sink(AbstractServerConnection.ConduitState state)
sourceback to summary
protected static StreamSourceConduit source(AbstractServerConnection.ConduitState state)
supportsOptionback to summary
public boolean supportsOption(final Option<?> option)

Implements abstract io.undertow.server.ServerConnection.supportsOption.

Implements org.xnio.channels.Configurable.supportsOption.

Doc from org.xnio.channels.Configurable.supportsOption.

Determine whether an option is supported on this channel.

Parameters
option:Option<?>

the option

Returns:boolean

true if it is supported

Annotations
@Override
io.undertow.server back to summary

private Class AbstractServerConnection.CloseSetter

extends Object
implements ChannelListener.Setter<ServerConnection>, ChannelListener<StreamConnection>
Class Inheritance
All Implemented Interfaces
org.xnio.ChannelListener, java.util.EventListener, org.xnio.ChannelListener.Setter

Field Summary

Modifier and TypeField and Description
private ChannelListener<? super ServerConnection>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
handleEvent(StreamConnection
the channel event
channel
)

Implements org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

public void
set(ChannelListener<? super ServerConnection>
the new listener
listener
)

Implements org.xnio.ChannelListener.Setter.set.

Set the listener, or null to ignore the associated event type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

listenerback to summary
private ChannelListener<? super ServerConnection> listener

Constructor Detail

CloseSetterback to summary
private CloseSetter()

Method Detail

handleEventback to summary
public void handleEvent(StreamConnection channel)

Implements org.xnio.ChannelListener.handleEvent.

Doc from org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Parameters
channel:StreamConnection

the channel event

Annotations
@Override
setback to summary
public void set(ChannelListener<? super ServerConnection> listener)

Implements org.xnio.ChannelListener.Setter.set.

Doc from org.xnio.ChannelListener.Setter.set.

Set the listener, or null to ignore the associated event type.

Parameters
listener:ChannelListener<? super ServerConnection>

the new listener

Annotations
@Override
io.undertow.server back to summary

public Class AbstractServerConnection.ConduitState

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final StreamSinkConduit
pack-priv final StreamSourceConduit

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sinkback to summary
pack-priv final StreamSinkConduit sink
sourceback to summary
pack-priv final StreamSourceConduit source

Constructor Detail

ConduitStateback to summary
private ConduitState(final StreamSinkConduit sink, final StreamSourceConduit source)