io.undertow.server.protocol.ajp

## Class AjpServerConnection

- java.lang.Object
- - io.undertow.util.AbstractAttachable
  - - io.undertow.server.ServerConnection
    - - io.undertow.server.AbstractServerConnection
      - - io.undertow.server.protocol.ajp.AjpServerConnection

All Implemented Interfaces:
  Attachable, Closeable, AutoCloseable, Channel, InterruptibleChannel, org.xnio.channels.BoundChannel, org.xnio.channels.CloseableChannel, org.xnio.channels.Configurable, org.xnio.channels.ConnectedChannel

    public final class AjpServerConnection
    extends AbstractServerConnection

A server-side AJP connection.

Author:
  David M. Lloyd

### Nested Class Summary

### Nested classes/interfaces inherited from class io.undertow.server.AbstractServerConnection

`AbstractServerConnection.ConduitState`

### Nested classes/interfaces inherited from class io.undertow.server.ServerConnection

`ServerConnection.CloseListener`

### Field Summary

### Fields inherited from class io.undertow.server.AbstractServerConnection

`bufferPool, channel, closeListeners, closeSetter, current, extraBytes, originalSinkConduit, originalSourceConduit, rootHandler, undertowOptions`

### Fields inherited from interface org.xnio.channels.Configurable

`EMPTY`

### Constructor Summary

Constructors
Constructor and Description
`AjpServerConnection(org.xnio.StreamConnection channel, ByteBufferPool bufferPool, HttpHandler rootHandler, org.xnio.OptionMap undertowOptions, int bufferSize)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `clearChannel()` Resets the channel to its original state, effectively disabling all current conduit wrappers.
`protected void` `exchangeComplete(HttpServerExchange exchange)` Invoked when the exchange is complete.
`protected org.xnio.conduits.StreamSinkConduit` `getSinkConduit(HttpServerExchange exchange, org.xnio.conduits.StreamSinkConduit conduit)` Gets the sink conduit that should be used for this request.
`SSLSessionInfo` `getSslSessionInfo()` Gets SSL information about the connection.
`String` `getTransportProtocol()` Returns a string representation describing the protocol used to transmit messages on this connection.
`protected boolean` `isConnectSupported()`
`boolean` `isContinueResponseSupported()`
`boolean` `isRequestTrailerFieldsSupported()`
`protected boolean` `isUpgradeSupported()`
`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.
`HttpServerExchange` `sendOutOfBandResponse(HttpServerExchange exchange)` Sends an out of band response, such as a HTTP 100-continue response.
`protected void` `setConnectListener(HttpUpgradeListener connectListener)`
`void` `setSslSessionInfo(SSLSessionInfo sessionInfo)` Sets the current SSL information.
`void` `terminateRequestChannel(HttpServerExchange exchange)` Invoked when the exchange is complete, and there is still data in the request channel.
`protected org.xnio.StreamConnection` `upgradeChannel()` Upgrade the connection, if allowed

### Methods inherited from class io.undertow.server.AbstractServerConnection

`addCloseListener, close, getBufferPool, getBufferSize, getByteBufferPool, getChannel, getCloseSetter, getExtraBytes, getIoThread, getLocalAddress, getLocalAddress, getOption, getOriginalSinkConduit, getOriginalSourceConduit, getPeerAddress, getPeerAddress, getRootHandler, getSinkChannel, getSourceChannel, getUndertowOptions, getWorker, isOpen, maxEntitySizeUpdated, setExtraBytes, setOption, setUpgradeListener, sink, source, supportsOption`

### Methods inherited from class io.undertow.server.ServerConnection

`getSslSession, isPushSupported, pushResource, pushResource`

### Methods inherited from class io.undertow.util.AbstractAttachable

`addToAttachmentList, createAttachmentMap, getAttachment, getAttachmentList, putAttachment, removeAttachment`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AjpServerConnection

    public AjpServerConnection(org.xnio.StreamConnection channel,
                               ByteBufferPool bufferPool,
                               HttpHandler rootHandler,
                               org.xnio.OptionMap undertowOptions,
                               int bufferSize)

### Method Detail

#### sendOutOfBandResponse

    public HttpServerExchange sendOutOfBandResponse(HttpServerExchange exchange)

Description copied from class: `ServerConnection`
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.

Specified by:
  `sendOutOfBandResponse` in class `ServerConnection`
Parameters:
  `exchange` - The current exchange
Returns:
  The out of band exchange.

#### isContinueResponseSupported

    public boolean isContinueResponseSupported()

Specified by:
  `isContinueResponseSupported` in class `ServerConnection`
Returns:
  `true` if this connection supports sending a 100-continue response

#### terminateRequestChannel

    public void terminateRequestChannel(HttpServerExchange exchange)

Description copied from class: `ServerConnection`
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.

Specified by:
  `terminateRequestChannel` in class `ServerConnection`
Parameters:
  `exchange` - The current exchange.

#### restoreChannel

    public void restoreChannel(AbstractServerConnection.ConduitState state)

Description copied from class: `AbstractServerConnection`
Restores the channel conduits to a previous state.

Overrides:
  `restoreChannel` in class `AbstractServerConnection`
Parameters:
  `state` - The original state
See Also:
  `AbstractServerConnection.resetChannel()`

#### resetChannel

    public AbstractServerConnection.ConduitState resetChannel()

Description copied from class: `AbstractServerConnection`
Resets the channel to its original state, effectively disabling all current conduit wrappers. The current state is encapsulated inside a `AbstractServerConnection.ConduitState` object that can be used the restore the channel.

Overrides:
  `resetChannel` in class `AbstractServerConnection`
Returns:
  An opaque representation of the previous channel state

#### clearChannel

    public void clearChannel()

Description copied from class: `AbstractServerConnection`
Resets the channel to its original state, effectively disabling all current conduit wrappers. The current state is lost.

Overrides:
  `clearChannel` in class `AbstractServerConnection`

#### getSslSessionInfo

    public SSLSessionInfo getSslSessionInfo()

Description copied from class: `ServerConnection`
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.

Specified by:
  `getSslSessionInfo` in class `ServerConnection`
Returns:
  SSL information about the connection

#### setSslSessionInfo

    public void setSslSessionInfo(SSLSessionInfo sessionInfo)

Description copied from class: `ServerConnection`
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.

Specified by:
  `setSslSessionInfo` in class `ServerConnection`
Parameters:
  `sessionInfo` - The ssl session information

#### upgradeChannel

    protected org.xnio.StreamConnection upgradeChannel()

Description copied from class: `ServerConnection`
Upgrade the connection, if allowed

Specified by:
  `upgradeChannel` in class `ServerConnection`
Returns:
  The StreamConnection that should be passed to the upgrade handler

#### getSinkConduit

    protected org.xnio.conduits.StreamSinkConduit getSinkConduit(HttpServerExchange exchange,
                                                                 org.xnio.conduits.StreamSinkConduit conduit)

Description copied from class: `ServerConnection`
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.

Specified by:
  `getSinkConduit` in class `ServerConnection`
Returns:
  The source conduit

#### isUpgradeSupported

    protected boolean isUpgradeSupported()

Specified by:
  `isUpgradeSupported` in class `ServerConnection`
Returns:
  true if this connection supports HTTP upgrade

#### isConnectSupported

    protected boolean isConnectSupported()

Specified by:
  `isConnectSupported` in class `ServerConnection`
Returns:
  `true` if this connection supports the HTTP CONNECT verb

#### exchangeComplete

    protected void exchangeComplete(HttpServerExchange exchange)

Description copied from class: `ServerConnection`
Invoked when the exchange is complete.

Specified by:
  `exchangeComplete` in class `ServerConnection`

#### setConnectListener

    protected void setConnectListener(HttpUpgradeListener connectListener)

Specified by:
  `setConnectListener` in class `ServerConnection`

#### getTransportProtocol

    public String getTransportProtocol()

Description copied from class: `ServerConnection`
Returns a string representation describing the protocol used to transmit messages on this connection.

Specified by:
  `getTransportProtocol` in class `ServerConnection`
Returns:
  the transport protocol

#### isRequestTrailerFieldsSupported

    public boolean isRequestTrailerFieldsSupported()

Specified by:
  `isRequestTrailerFieldsSupported` in class `ServerConnection`