Package 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
-
-
Constructor Summary
Constructors Constructor Description AjpClientChannel(org.xnio.StreamConnection connectedStreamChannel, ByteBufferPool bufferPool, org.xnio.OptionMap settings)
Create a newAbstractFramedChannel
8
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
-
-
-
Constructor Detail
-
AjpClientChannel
public AjpClientChannel(org.xnio.StreamConnection connectedStreamChannel, ByteBufferPool bufferPool, org.xnio.OptionMap settings)
Create a newAbstractFramedChannel
8- Parameters:
connectedStreamChannel
- TheConnectedStreamChannel
over which the WebSocket Frames should get send and received. Be aware that it already must be "upgraded".bufferPool
- ThePool
which will be used to acquireByteBuffer
'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 classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>
- Parameters:
frameHeaderData
- The header data, as returned byAbstractFramedChannel.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 classAbstractFramedChannel<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 classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>
- Returns:
true
If the last frame has been received
-
isLastFrameSent
protected boolean isLastFrameSent()
- Specified by:
isLastFrameSent
in classAbstractFramedChannel<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.
-
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.
-
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.
-
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.
-
getReceivers
protected Collection<AbstractFramedStreamSourceChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>> getReceivers()
- Specified by:
getReceivers
in classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>
-
getSettings
protected org.xnio.OptionMap getSettings()
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfaceChannel
- Overrides:
isOpen
in classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>
-
recalculateHeldFrames
protected void recalculateHeldFrames() throws IOException
- Overrides:
recalculateHeldFrames
in classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>
- Throws:
IOException
-
sendPing
public void sendPing(ClientConnection.PingListener pingListener, long timeout, TimeUnit timeUnit)
-
-