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:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,java.nio.channels.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 newAbstractFramedChannel8
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseSubChannels()Method that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.protected AbstractAjpClientStreamSourceChannelcreateChannel(FrameHeaderData frameHeaderData, PooledByteBuffer frameData)Method that creates the actual stream source channel implementation that is in use.protected java.util.Collection<AbstractFramedStreamSourceChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>>getReceivers()protected org.xnio.OptionMapgetSettings()protected voidhandleBrokenSinkChannel(java.lang.Throwable e)Method that is invoked when then write side of a channel is broken.protected voidhandleBrokenSourceChannel(java.lang.Throwable e)Method that is invoked when the read side of the channel is broken.protected booleanisLastFrameReceived()Returns true if the protocol specific final frame has been received.protected booleanisLastFrameSent()booleanisOpen()protected voidlastDataRead()Method than is invoked when read() returns -1.protected FrameHeaderDataparseFrame(java.nio.ByteBuffer data)Attempts to parse an incoming frame header from the data in the buffer.protected voidrecalculateHeldFrames()voidsendPing(ClientConnection.PingListener pingListener, long timeout, java.util.concurrent.TimeUnit timeUnit)AjpClientRequestClientStreamSinkChannelsendRequest(HttpString method, java.lang.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 newAbstractFramedChannel8- Parameters:
connectedStreamChannel- TheConnectedStreamChannelover which the WebSocket Frames should get send and received. Be aware that it already must be "upgraded".bufferPool- ThePoolwhich will be used to acquireByteBuffer's from.
-
-
Method Detail
-
createChannel
protected AbstractAjpClientStreamSourceChannel createChannel(FrameHeaderData frameHeaderData, PooledByteBuffer frameData) throws java.io.IOException
Description copied from class:AbstractFramedChannelMethod that creates the actual stream source channel implementation that is in use.- Specified by:
createChannelin 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:
java.io.IOException
-
parseFrame
protected FrameHeaderData parseFrame(java.nio.ByteBuffer data) throws java.io.IOException
Description copied from class:AbstractFramedChannelAttempts to parse an incoming frame header from the data in the buffer.- Specified by:
parseFramein classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>- Parameters:
data- The data that has been read from the channel- Returns:
- The frame header data, or
nullif the data was incomplete - Throws:
java.io.IOException- If the data could not be parsed.
-
sendRequest
public AjpClientRequestClientStreamSinkChannel sendRequest(HttpString method, java.lang.String path, HttpString protocol, HeaderMap headers, Attachable attachable, org.xnio.ChannelListener<AjpClientRequestClientStreamSinkChannel> finishListener)
-
isLastFrameReceived
protected boolean isLastFrameReceived()
Description copied from class:AbstractFramedChannelReturns true if the protocol specific final frame has been received.- Specified by:
isLastFrameReceivedin classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>- Returns:
trueIf the last frame has been received
-
isLastFrameSent
protected boolean isLastFrameSent()
- Specified by:
isLastFrameSentin classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>- Returns:
trueIf the last frame has been sent
-
lastDataRead
protected void lastDataRead()
Description copied from class:AbstractFramedChannelMethod than is invoked when read() returns -1.
-
handleBrokenSourceChannel
protected void handleBrokenSourceChannel(java.lang.Throwable e)
Description copied from class:AbstractFramedChannelMethod that is invoked when the read side of the channel is broken. This generally happens on a protocol error.
-
handleBrokenSinkChannel
protected void handleBrokenSinkChannel(java.lang.Throwable e)
Description copied from class:AbstractFramedChannelMethod 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:AbstractFramedChannelMethod that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.
-
getReceivers
protected java.util.Collection<AbstractFramedStreamSourceChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>> getReceivers()
- Specified by:
getReceiversin classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>
-
getSettings
protected org.xnio.OptionMap getSettings()
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfacejava.nio.channels.Channel- Overrides:
isOpenin classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>
-
recalculateHeldFrames
protected void recalculateHeldFrames() throws java.io.IOException- Overrides:
recalculateHeldFramesin classAbstractFramedChannel<AjpClientChannel,AbstractAjpClientStreamSourceChannel,AbstractAjpClientStreamSinkChannel>- Throws:
java.io.IOException
-
sendPing
public void sendPing(ClientConnection.PingListener pingListener, long timeout, java.util.concurrent.TimeUnit timeUnit)
-
-