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

public Class AjpServerRequestConduit

extends AbstractStreamSourceConduit<StreamSourceConduit>
Class Inheritance
Static Imports
org.xnio.Bits.anyAreSet, .Bits.longBitMask

Underlying AJP request channel.
Author
Stuart Douglas

Field Summary

Modifier and TypeField and Description
private final AjpServerResponseConduit
private final HttpServerExchange
private final ConduitListener<? super AjpServerRequestConduit>
private static final int
private final ByteBuffer
headerBuffer

byte buffer that is used to hold header data

private static final ByteBuffer
private long
remaining

/** The total amount of remaining data.

private long
state

State flags, with the chunk remaining stored in the low bytes

private static final long
STATE_FINISHED

read is done

private static final long
STATE_MASK

The remaining bits are used to store the remaining chunk size.

private static final long
STATE_READING

There is a packet coming from apache.

private static final long
STATE_SEND_REQUIRED

There is no packet coming, as we need to set a GET_BODY_CHUNK message

private long
totalRead

The total amount of data that has been read

Constructor Summary

AccessConstructor and Description
public
AjpServerRequestConduit(final StreamSourceConduit delegate, HttpServerExchange exchange, AjpServerResponseConduit ajpResponseConduit, Long size, ConduitListener<? super AjpServerRequestConduit> finishListener)

Method Summary

Modifier and TypeMethod and Description
public void
awaitReadable()

Overrides org.xnio.conduits.AbstractSourceConduit.awaitReadable.

Implements org.xnio.conduits.SourceConduit.awaitReadable.

Block until this channel becomes readable again.

public void
awaitReadable(long
the time to wait
time
,
TimeUnit
the time unit
timeUnit
)

Overrides org.xnio.conduits.AbstractSourceConduit.awaitReadable.

Implements org.xnio.conduits.SourceConduit.awaitReadable.

Block until this conduit becomes readable again, or until the timeout expires.

private int
doRead(final ByteBuffer dst, long state)

public long
read(ByteBuffer[]
the buffers to fill with data from the conduit
dsts
,
int
the offset into the buffer array
offset
,
int
the number of buffers to fill
length
)

Overrides org.xnio.conduits.AbstractStreamSourceConduit.read.

Implements org.xnio.conduits.StreamSourceConduit.read.

Read a sequence of bytes from this conduit to the given buffers.

public int
read(ByteBuffer
the buffer to fill with data from the conduit
dst
)

Overrides org.xnio.conduits.AbstractStreamSourceConduit.read.

Implements org.xnio.conduits.StreamSourceConduit.read.

Read a sequence of bytes from this conduit to the given buffer.

pack-priv void
setReadBodyChunkError(IOException e)

Method that is called when an error occurs writing out read body chunk frames

public void
terminateReads()

Overrides org.xnio.conduits.AbstractSourceConduit.terminateReads.

Implements org.xnio.conduits.SourceConduit.terminateReads.

Indicate that no more data will be read from this conduit.

public long
transferTo(long
the position within the file from which the transfer is to begin
position
,
long
the number of bytes to be transferred
count
,
FileChannel
the file to write to
target
)

Overrides org.xnio.conduits.AbstractStreamSourceConduit.transferTo.

Implements org.xnio.conduits.StreamSourceConduit.transferTo.

Transfers bytes into the given file from this channel.

public long
transferTo(long
the number of bytes to be transferred
count
,
ByteBuffer
the buffer to copy through.
throughBuffer
,
StreamSinkChannel
the destination to write to
target
)

Overrides org.xnio.conduits.AbstractStreamSourceConduit.transferTo.

Implements org.xnio.conduits.StreamSourceConduit.transferTo.

Transfers bytes into the given channel target.

Field Detail

ajpResponseConduitback to summary
private final AjpServerResponseConduit ajpResponseConduit
exchangeback to summary
private final HttpServerExchange exchange
finishListenerback to summary
private final ConduitListener<? super AjpServerRequestConduit> finishListener
HEADER_LENGTHback to summary
private static final int HEADER_LENGTH
headerBufferback to summary
private final ByteBuffer headerBuffer

byte buffer that is used to hold header data

READ_BODY_CHUNKback to summary
private static final ByteBuffer READ_BODY_CHUNK
remainingback to summary
private long remaining

/** The total amount of remaining data. If this is unknown it is -1.

stateback to summary
private long state

State flags, with the chunk remaining stored in the low bytes

STATE_FINISHEDback to summary
private static final long STATE_FINISHED

read is done

STATE_MASKback to summary
private static final long STATE_MASK

The remaining bits are used to store the remaining chunk size.

STATE_READINGback to summary
private static final long STATE_READING

There is a packet coming from apache.

STATE_SEND_REQUIREDback to summary
private static final long STATE_SEND_REQUIRED

There is no packet coming, as we need to set a GET_BODY_CHUNK message

totalReadback to summary
private long totalRead

The total amount of data that has been read

Constructor Detail

AjpServerRequestConduitback to summary
public AjpServerRequestConduit(final StreamSourceConduit delegate, HttpServerExchange exchange, AjpServerResponseConduit ajpResponseConduit, Long size, ConduitListener<? super AjpServerRequestConduit> finishListener)

Method Detail

awaitReadableback to summary
public void awaitReadable() throws IOException

Overrides org.xnio.conduits.AbstractSourceConduit.awaitReadable.

Implements org.xnio.conduits.SourceConduit.awaitReadable.

Doc from org.xnio.conduits.SourceConduit.awaitReadable.

Block until this channel becomes readable again. This method may return spuriously before the channel becomes readable.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
awaitReadableback to summary
public void awaitReadable(long time, TimeUnit timeUnit) throws IOException

Overrides org.xnio.conduits.AbstractSourceConduit.awaitReadable.

Implements org.xnio.conduits.SourceConduit.awaitReadable.

Doc from org.xnio.conduits.SourceConduit.awaitReadable.

Block until this conduit becomes readable again, or until the timeout expires. This method may return spuriously before the conduit becomes readable or the timeout expires.

Parameters
time:long

the time to wait

timeUnit:TimeUnit

the time unit

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
doReadback to summary
private int doRead(final ByteBuffer dst, long state) throws IOException
readback to summary
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException

Overrides org.xnio.conduits.AbstractStreamSourceConduit.read.

Implements org.xnio.conduits.StreamSourceConduit.read.

Doc from org.xnio.conduits.StreamSourceConduit.read.

Read a sequence of bytes from this conduit to the given buffers.

Parameters
dsts:ByteBuffer[]

the buffers to fill with data from the conduit

offset:int

the offset into the buffer array

length:int

the number of buffers to fill

Returns:long

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached or this conduit's terminateReads() method was previously called

Annotations
@Override
Exceptions
IOException:
if an error occurs
readback to summary
public int read(ByteBuffer dst) throws IOException

Overrides org.xnio.conduits.AbstractStreamSourceConduit.read.

Implements org.xnio.conduits.StreamSourceConduit.read.

Doc from org.xnio.conduits.StreamSourceConduit.read.

Read a sequence of bytes from this conduit to the given buffer.

Parameters
dst:ByteBuffer

the buffer to fill with data from the conduit

Returns:int

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached or this conduit's terminateReads() method was previously called

Annotations
@Override
Exceptions
IOException:
if an error occurs
setReadBodyChunkErrorback to summary
pack-priv void setReadBodyChunkError(IOException e)

Method that is called when an error occurs writing out read body chunk frames

terminateReadsback to summary
public void terminateReads() throws IOException

Overrides org.xnio.conduits.AbstractSourceConduit.terminateReads.

Implements org.xnio.conduits.SourceConduit.terminateReads.

Doc from org.xnio.conduits.SourceConduit.terminateReads.

Indicate that no more data will be read from this conduit. If unread data exists, an exception may be thrown.

Annotations
@Override
Exceptions
IOException:
if there was a problem
transferToback to summary
public long transferTo(long position, long count, FileChannel target) throws IOException

Overrides org.xnio.conduits.AbstractStreamSourceConduit.transferTo.

Implements org.xnio.conduits.StreamSourceConduit.transferTo.

Doc from org.xnio.conduits.StreamSourceConduit.transferTo.

Transfers bytes into the given file from this channel.

Parameters
position:long

the position within the file from which the transfer is to begin

count:long

the number of bytes to be transferred

target:FileChannel

the file to write to

Returns:long

the number of bytes (possibly 0) that were actually transferred

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
transferToback to summary
public long transferTo(long count, ByteBuffer throughBuffer, StreamSinkChannel target) throws IOException

Overrides org.xnio.conduits.AbstractStreamSourceConduit.transferTo.

Implements org.xnio.conduits.StreamSourceConduit.transferTo.

Doc from org.xnio.conduits.StreamSourceConduit.transferTo.

Transfers bytes into the given channel target. On entry, throughBuffer will be cleared. On exit, the buffer will be flipped for emptying, and may possibly be empty or may contain data. If this method returns a value less than count, then the remaining data in throughBuffer may contain data read from this channel which must be written to target to complete the operation.

Parameters
count:long

the number of bytes to be transferred

throughBuffer:ByteBuffer

the buffer to copy through.

target:StreamSinkChannel

the destination to write to

Returns:long

the number of bytes (possibly 0) that were actually transferred, or -1 if the end of input was reached

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs