Top Description Fields Constructors Methods
io.undertow.server.protocol.http

public final Class HttpServerConnection

extends AbstractServerConnection
Class Inheritance
Imports
io.undertow.UndertowMessages, io.undertow.conduits.ReadDataStreamSourceConduit, io.undertow.server.AbstractServerConnection, .ConduitWrapper, .ConnectionSSLSessionInfo, .ConnectorStatisticsImpl, .Connectors, .ExchangeCompletionListener, .HttpHandler, .HttpServerExchange, .HttpUpgradeListener, .SSLSessionInfo, .ServerConnection, io.undertow.util.ConduitFactory, .Headers, .HttpString, .ImmediatePooledByteBuffer, .Methods, org.xnio.IoUtils, .OptionMap, .StreamConnection, io.undertow.connector.ByteBufferPool, .PooledByteBuffer, org.xnio.channels.SslChannel, org.xnio.conduits.StreamSinkConduit, javax.net.ssl.SSLSession, java.nio.ByteBuffer

A server-side HTTP connection.

Note that the lifecycle of the server connection is tied to the underlying TCP connection. Even if the channel is upgraded the connection is not considered closed until the upgraded channel is closed.

Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private boolean
private ServerFixedLengthStreamSinkConduit
private PipeliningBufferingStreamSinkConduit
private ReadDataStreamSourceConduit
private HttpReadListener
private HttpResponseConduit
private SSLSessionInfo
private HttpUpgradeListener
Inherited from io.undertow.server.AbstractServerConnection:
bufferPoolchannelcloseListenerscloseSettercurrentextraBytesoriginalSinkConduitoriginalSourceConduitrootHandlerundertowOptions

Constructor Summary

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

Method Summary

Modifier and TypeMethod and Description
protected void
exchangeComplete(HttpServerExchange exchange)

Implements abstract io.undertow.server.ServerConnection.exchangeComplete.

Invoked when the exchange is complete.

pack-priv ServerFixedLengthStreamSinkConduit
public PipeliningBufferingStreamSinkConduit
pack-priv ReadDataStreamSourceConduit
pack-priv HttpReadListener
public HttpResponseConduit
protected StreamSinkConduit
getSinkConduit(HttpServerExchange exchange, StreamSinkConduit conduit)

Implements abstract io.undertow.server.ServerConnection.getSinkConduit.

Gets the sink conduit that should be used for this request.

public SSLSession
getSslSession()

Overrides io.undertow.server.ServerConnection.getSslSession.

Gets the SSLSession of the underlying connection, or null if SSL is not in use.

public SSLSessionInfo
getSslSessionInfo()

Implements abstract io.undertow.server.ServerConnection.getSslSessionInfo.

Gets SSL information about the connection.

public String
getTransportProtocol()

Implements abstract io.undertow.server.ServerConnection.getTransportProtocol.

Returns a string representation describing the protocol used to transmit messages on this connection.

protected HttpUpgradeListener
pack-priv boolean
protected boolean
public boolean
public boolean
protected boolean
public HttpServerExchange
sendOutOfBandResponse(HttpServerExchange
The current exchange
exchange
)

Implements abstract io.undertow.server.ServerConnection.sendOutOfBandResponse.

Sends an out of band response, such as a HTTP 100-continue response.

protected void
pack-priv void
public void
pack-priv void
public void
setSslSessionInfo(SSLSessionInfo
The ssl session information
sessionInfo
)

Implements abstract io.undertow.server.ServerConnection.setSslSessionInfo.

Sets the current SSL information.

protected void
public void
terminateRequestChannel(HttpServerExchange
The current exchange.
exchange
)

Implements abstract io.undertow.server.ServerConnection.terminateRequestChannel.

Invoked when the exchange is complete, and there is still data in the request channel.

public void
ungetRequestBytes(final PooledByteBuffer
The buffer to push back
unget
)

Pushes back the given data.

protected StreamConnection
upgradeChannel()

Implements abstract io.undertow.server.ServerConnection.upgradeChannel.

Upgrade the connection, if allowed

Inherited from io.undertow.server.AbstractServerConnection:
addCloseListenerclearChannelclosegetBufferPoolgetBufferSizegetByteBufferPoolgetChannelgetCloseSettergetExtraBytesgetIoThreadgetLocalAddressgetLocalAddressgetOptiongetOriginalSinkConduitgetOriginalSourceConduitgetPeerAddressgetPeerAddressgetRootHandlergetSinkChannelgetSourceChannelgetUndertowOptionsgetWorkerisOpenmaxEntitySizeUpdatedresetChannelrestoreChannelsetExtraBytessetOptionsinksourcesupportsOption

Field Detail

connectHandledback to summary
private boolean connectHandled
fixedLengthStreamSinkConduitback to summary
private ServerFixedLengthStreamSinkConduit fixedLengthStreamSinkConduit
pipelineBufferback to summary
private PipeliningBufferingStreamSinkConduit pipelineBuffer
readDataStreamSourceConduitback to summary
private ReadDataStreamSourceConduit readDataStreamSourceConduit
readListenerback to summary
private HttpReadListener readListener
responseConduitback to summary
private HttpResponseConduit responseConduit
sslSessionInfoback to summary
private SSLSessionInfo sslSessionInfo
upgradeListenerback to summary
private HttpUpgradeListener upgradeListener

Constructor Detail

HttpServerConnectionback to summary
public HttpServerConnection(StreamConnection channel, final ByteBufferPool bufferPool, final HttpHandler rootHandler, final OptionMap undertowOptions, final int bufferSize, final ConnectorStatisticsImpl connectorStatistics)

Method Detail

exchangeCompleteback to summary
protected void exchangeComplete(HttpServerExchange exchange)

Implements abstract io.undertow.server.ServerConnection.exchangeComplete.

Doc from io.undertow.server.ServerConnection.exchangeComplete.

Invoked when the exchange is complete.

Annotations
@Override
getFixedLengthStreamSinkConduitback to summary
pack-priv ServerFixedLengthStreamSinkConduit getFixedLengthStreamSinkConduit()
getPipelineBufferback to summary
public PipeliningBufferingStreamSinkConduit getPipelineBuffer()
getReadDataStreamSourceConduitback to summary
pack-priv ReadDataStreamSourceConduit getReadDataStreamSourceConduit()
getReadListenerback to summary
pack-priv HttpReadListener getReadListener()
getResponseConduitback to summary
public HttpResponseConduit getResponseConduit()
getSinkConduitback to summary
protected StreamSinkConduit getSinkConduit(HttpServerExchange exchange, StreamSinkConduit conduit)

Implements abstract io.undertow.server.ServerConnection.getSinkConduit.

Doc from io.undertow.server.ServerConnection.getSinkConduit.

Gets the sink conduit that should be used for this request. This allows the connection to apply any per-request conduit wrapping that is required, without adding to the response wrappers array. There is no corresponding method for source conduits, as in general conduits can be directly inserted into the connection after the request has been read.

Returns:StreamSinkConduit

The source conduit

Annotations
@Override
getSslSessionback to summary
public SSLSession getSslSession()

Overrides io.undertow.server.ServerConnection.getSslSession.

Doc from io.undertow.server.ServerConnection.getSslSession.

Gets the SSLSession of the underlying connection, or null if SSL is not in use. Note that for client cert auth getSslSessionInfo() should be used instead, as it takes into account other information potentially provided by load balancers that terminate SSL

Returns:SSLSession

The SSLSession of the connection

getSslSessionInfoback to summary
public SSLSessionInfo getSslSessionInfo()

Implements abstract io.undertow.server.ServerConnection.getSslSessionInfo.

Doc from io.undertow.server.ServerConnection.getSslSessionInfo.

Gets SSL information about the connection. This could represent the actual client connection, or could be providing SSL information that was provided by a front end proxy.

Returns:SSLSessionInfo

SSL information about the connection

Annotations
@Override
getTransportProtocolback to summary
public String getTransportProtocol()

Implements abstract io.undertow.server.ServerConnection.getTransportProtocol.

Doc from io.undertow.server.ServerConnection.getTransportProtocol.

Returns a string representation describing the protocol used to transmit messages on this connection.

Returns:String

the transport protocol

Annotations
@Override
getUpgradeListenerback to summary
protected HttpUpgradeListener getUpgradeListener()
isConnectHandledback to summary
pack-priv boolean isConnectHandled()
isConnectSupportedback to summary
protected boolean isConnectSupported()

Implements abstract io.undertow.server.ServerConnection.isConnectSupported.

Returns:boolean

Doc from io.undertow.server.ServerConnection.isConnectSupported.

true if this connection supports the HTTP CONNECT verb

Annotations
@Override
isContinueResponseSupportedback to summary
public boolean isContinueResponseSupported()

Implements abstract io.undertow.server.ServerConnection.isContinueResponseSupported.

Returns:boolean

Doc from io.undertow.server.ServerConnection.isContinueResponseSupported.

true if this connection supports sending a 100-continue response

Annotations
@Override
isRequestTrailerFieldsSupportedback to summary
public boolean isRequestTrailerFieldsSupported()

Implements abstract io.undertow.server.ServerConnection.isRequestTrailerFieldsSupported.

Annotations
@Override
isUpgradeSupportedback to summary
protected boolean isUpgradeSupported()

Implements abstract io.undertow.server.ServerConnection.isUpgradeSupported.

Returns:boolean

Doc from io.undertow.server.ServerConnection.isUpgradeSupported.

true if this connection supports HTTP upgrade

Annotations
@Override
sendOutOfBandResponseback to summary
public HttpServerExchange sendOutOfBandResponse(HttpServerExchange exchange)

Implements abstract io.undertow.server.ServerConnection.sendOutOfBandResponse.

Doc from io.undertow.server.ServerConnection.sendOutOfBandResponse.

Sends an out of band response, such as a HTTP 100-continue response.

Warning

do not attempt to write to the current exchange until the out of band exchange has been fully written. Doing so may have unexpected results.

Todo

this needs more thought.

Parameters
exchange:HttpServerExchange

The current exchange

Returns:HttpServerExchange

The out of band exchange.

Annotations
@Override
setConnectListenerback to summary
protected void setConnectListener(HttpUpgradeListener connectListener)

Implements abstract io.undertow.server.ServerConnection.setConnectListener.

Annotations
@Override
setCurrentExchangeback to summary
pack-priv void setCurrentExchange(HttpServerExchange exchange)
setPipelineBufferback to summary
public void setPipelineBuffer(PipeliningBufferingStreamSinkConduit pipelineBuffer)
setReadListenerback to summary
pack-priv void setReadListener(HttpReadListener readListener)
setSslSessionInfoback to summary
public void setSslSessionInfo(SSLSessionInfo sessionInfo)

Implements abstract io.undertow.server.ServerConnection.setSslSessionInfo.

Doc from io.undertow.server.ServerConnection.setSslSessionInfo.

Sets the current SSL information. This can be used by handlers to setup SSL information that was provided by a front end proxy. If this is being set of a per request basis then you must ensure that it is either cleared by an exchange completion listener at the end of the request, or is always set for every request. Otherwise it is possible to SSL information to 'leak' between requests.

Parameters
sessionInfo:SSLSessionInfo

The ssl session information

Annotations
@Override
setUpgradeListenerback to summary
protected void setUpgradeListener(HttpUpgradeListener upgradeListener)

Overrides io.undertow.server.AbstractServerConnection.setUpgradeListener.

Annotations
@Override
terminateRequestChannelback to summary
public void terminateRequestChannel(HttpServerExchange exchange)

Implements abstract io.undertow.server.ServerConnection.terminateRequestChannel.

Doc from io.undertow.server.ServerConnection.terminateRequestChannel.

Invoked when the exchange is complete, and there is still data in the request channel. Some implementations (such as SPDY and HTTP2) have more efficient ways to drain the request than simply reading all data (e.g. RST_STREAM). After this method is invoked the stream will be drained normally.

Parameters
exchange:HttpServerExchange

The current exchange.

Annotations
@Override
ungetRequestBytesback to summary
public void ungetRequestBytes(final PooledByteBuffer unget)

Pushes back the given data. This should only be used by transfer coding handlers that have read past the end of the request when handling pipelined requests

Parameters
unget:PooledByteBuffer

The buffer to push back

upgradeChannelback to summary
protected StreamConnection upgradeChannel()

Implements abstract io.undertow.server.ServerConnection.upgradeChannel.

Doc from io.undertow.server.ServerConnection.upgradeChannel.

Upgrade the connection, if allowed

Returns:StreamConnection

The StreamConnection that should be passed to the upgrade handler

Annotations
@Override