io.undertow.protocols.ajp

## Class AjpClientChannel

- java.lang.Object
- - io.undertow.server.protocol.framed.AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>
  - - io.undertow.protocols.ajp.AjpClientChannel

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

    public class AjpClientChannel
    extends AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>

AJP client side channel.

Author:
  Stuart Douglas

### Field Summary

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

`EMPTY`

### Constructor Summary

Constructors
Constructor and Description
`AjpClientChannel(org.xnio.StreamConnection connectedStreamChannel, ByteBufferPool bufferPool, org.xnio.OptionMap settings)` Create a new `AbstractFramedChannel` 8

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `closeSubChannels()` Method that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.
`protected AbstractAjpClientStreamSourceChannel` `createChannel(FrameHeaderData frameHeaderData, PooledByteBuffer frameData)` Method that creates the actual stream source channel implementation that is in use.
`protected Collection<AbstractFramedStreamSourceChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>>` `getReceivers()`
`protected org.xnio.OptionMap` `getSettings()`
`protected void` `handleBrokenSinkChannel(Throwable e)` Method that is invoked when then write side of a channel is broken.
`protected void` `handleBrokenSourceChannel(Throwable e)` Method that is invoked when the read side of the channel is broken.
`protected boolean` `isLastFrameReceived()` Returns true if the protocol specific final frame has been received.
`protected boolean` `isLastFrameSent()`
`boolean` `isOpen()`
`protected void` `lastDataRead()` Method than is invoked when read() returns -1.
`protected FrameHeaderData` `parseFrame(ByteBuffer data)` Attempts to parse an incoming frame header from the data in the buffer.
`protected void` `recalculateHeldFrames()`
`void` `sendPing(ClientConnection.PingListener pingListener, long timeout, TimeUnit timeUnit)`
`AjpClientRequestClientStreamSinkChannel` `sendRequest(HttpString method, String path, HttpString protocol, HeaderMap headers, Attachable attachable, org.xnio.ChannelListener<AjpClientRequestClientStreamSinkChannel> finishListener)`

### Methods inherited from class io.undertow.server.protocol.framed.AbstractFramedChannel

`addCloseTask, close, createIdleTimeoutChannel, flush, flushSenders, getBufferPool, getCloseSetter, getDestinationAddress, getFramePriority, getIdleTimeout, getIoThread, getLocalAddress, getLocalAddress, getOption, getPeerAddress, getPeerAddress, getReceiveSetter, getSourceAddress, getUnderlyingConnection, getWorker, isReadsBroken, isReceivesResumed, isRequireExplicitFlush, isWritesBroken, markReadsBroken, markWritesBroken, queueFrame, receive, resumeReceives, setIdleTimeout, setOption, setRequireExplicitFlush, supportsOption, suspendReceives, toString, writeExceptionHandler`

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

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

### Constructor Detail

#### AjpClientChannel

    public AjpClientChannel(org.xnio.StreamConnection connectedStreamChannel,
                            ByteBufferPool bufferPool,
                            org.xnio.OptionMap settings)

Create a new `AbstractFramedChannel` 8

Parameters:
  `connectedStreamChannel` - The `ConnectedStreamChannel` over which the WebSocket Frames should get send and received. Be aware that it already must be "upgraded".
  `bufferPool` - The `Pool` which will be used to acquire `ByteBuffer`'s from.

### Method Detail

#### createChannel

    protected AbstractAjpClientStreamSourceChannel createChannel(FrameHeaderData frameHeaderData,
                                                                 PooledByteBuffer frameData)
                                                          throws IOException

Description copied from class: `AbstractFramedChannel`
Method that creates the actual stream source channel implementation that is in use.

Specified by:
  `createChannel` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`
Parameters:
  `frameHeaderData` - The header data, as returned by `AbstractFramedChannel.parseFrame(java.nio.ByteBuffer)`
  `frameData` - Any additional data for the frame that has already been read. This may not be the complete frame contents
Returns:
  A new stream source channel
Throws:
  `IOException`

#### parseFrame

    protected FrameHeaderData parseFrame(ByteBuffer data)
                                  throws IOException

Description copied from class: `AbstractFramedChannel`
Attempts to parse an incoming frame header from the data in the buffer.

Specified by:
  `parseFrame` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`
Parameters:
  `data` - The data that has been read from the channel
Returns:
  The frame header data, or `null` if the data was incomplete
Throws:
  `IOException` - If the data could not be parsed.

#### sendRequest

    public AjpClientRequestClientStreamSinkChannel sendRequest(HttpString method,
                                                               String path,
                                                               HttpString protocol,
                                                               HeaderMap headers,
                                                               Attachable attachable,
                                                               org.xnio.ChannelListener<AjpClientRequestClientStreamSinkChannel> finishListener)

#### isLastFrameReceived

    protected boolean isLastFrameReceived()

Description copied from class: `AbstractFramedChannel`
Returns true if the protocol specific final frame has been received.

Specified by:
  `isLastFrameReceived` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`
Returns:
  `true` If the last frame has been received

#### isLastFrameSent

    protected boolean isLastFrameSent()

Specified by:
  `isLastFrameSent` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`
Returns:
  `true` If the last frame has been sent

#### lastDataRead

    protected void lastDataRead()

Description copied from class: `AbstractFramedChannel`
Method than is invoked when read() returns -1.

Overrides:
  `lastDataRead` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`

#### handleBrokenSourceChannel

    protected void handleBrokenSourceChannel(Throwable e)

Description copied from class: `AbstractFramedChannel`
Method that is invoked when the read side of the channel is broken. This generally happens on a protocol error.

Specified by:
  `handleBrokenSourceChannel` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`

#### handleBrokenSinkChannel

    protected void handleBrokenSinkChannel(Throwable e)

Description copied from class: `AbstractFramedChannel`
Method that is invoked when then write side of a channel is broken. This generally happens on a protocol error.

Specified by:
  `handleBrokenSinkChannel` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`

#### closeSubChannels

    protected void closeSubChannels()

Description copied from class: `AbstractFramedChannel`
Method that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.

Specified by:
  `closeSubChannels` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`

#### getReceivers

    protected Collection<AbstractFramedStreamSourceChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>> getReceivers()

Specified by:
  `getReceivers` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`

#### getSettings

    protected org.xnio.OptionMap getSettings()

Overrides:
  `getSettings` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`

#### isOpen

    public boolean isOpen()

Specified by:
  `isOpen` in interface `Channel`
Overrides:
  `isOpen` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`

#### recalculateHeldFrames

    protected void recalculateHeldFrames()
                                  throws IOException

Overrides:
  `recalculateHeldFrames` in class `AbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>`
Throws:
  `IOException`

#### sendPing

    public void sendPing(ClientConnection.PingListener pingListener,
                         long timeout,
                         TimeUnit timeUnit)