Top Description Fields Constructors Methods
org.apache.coyote.http11.filters

public Class BufferedInputFilter

extends Object
implements InputFilter, ApplicationBufferHandler
Class Inheritance
All Implemented Interfaces
org.apache.tomcat.util.net.ApplicationBufferHandler, org.apache.coyote.http11.InputFilter, org.apache.coyote.InputBuffer
Imports
java.io.IOException, java.nio.BufferOverflowException, .ByteBuffer, java.nio.charset.StandardCharsets, org.apache.coyote.InputBuffer, .Request, org.apache.coyote.http11.InputFilter, org.apache.tomcat.util.buf.ByteChunk, org.apache.tomcat.util.net.ApplicationBufferHandler, org.apache.tomcat.util.res.StringManager

Input filter responsible for reading and buffering the request body, so that it does not interfere with client SSL handshake messages.

Field Summary

Modifier and TypeField and Description
private InputBuffer
private ByteChunk
private static final ByteChunk
private static final String
private boolean
private final int
private static final StringManager
private ByteBuffer

Constructor Summary

AccessConstructor and Description
public
BufferedInputFilter(int maxSwallowSize)

Method Summary

Modifier and TypeMethod and Description
public int
available()

Implements org.apache.coyote.InputBuffer.available.

Obtain an estimate of the number of bytes that can be read without blocking.

public int
doRead(ApplicationBufferHandler
ApplicationBufferHandler that provides the buffer to read data into.
handler
)

Implements org.apache.coyote.InputBuffer.doRead.

Fills the given ByteBuffer with the buffered request body.

public long
end()

Implements org.apache.coyote.http11.InputFilter.end.

End the current request.

public void
public ByteBuffer
public ByteChunk
getEncodingName()

Implements org.apache.coyote.http11.InputFilter.getEncodingName.

Get the name of the encoding handled by this filter.

public boolean
isFinished()

Implements org.apache.coyote.http11.InputFilter.isFinished.

Has the request body been read fully?

public void
recycle()

Implements org.apache.coyote.http11.InputFilter.recycle.

Make the filter ready to process the next request.

public void
setBuffer(InputBuffer
The next buffer
buffer
)

Implements org.apache.coyote.http11.InputFilter.setBuffer.

Set the next buffer in the filter pipeline.

public void
public void
setLimit(int
The maximum number of bytes that will be buffered
limit
)

Set the buffering limit.

public void
setRequest(Request
The request to be associated with this filter
request
)

Implements org.apache.coyote.http11.InputFilter.setRequest.

Reads the request body and buffers it.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private InputBuffer buffer
bufferedback to summary
private ByteChunk buffered
ENCODINGback to summary
private static final ByteChunk ENCODING
ENCODING_NAMEback to summary
private static final String ENCODING_NAME
hasReadback to summary
private boolean hasRead
maxSwallowSizeback to summary
private final int maxSwallowSize
smback to summary
private static final StringManager sm
tempReadback to summary
private ByteBuffer tempRead

Constructor Detail

BufferedInputFilterback to summary
public BufferedInputFilter(int maxSwallowSize)

Method Detail

availableback to summary
public int available()

Implements org.apache.coyote.InputBuffer.available.

Doc from org.apache.coyote.InputBuffer.available.

Obtain an estimate of the number of bytes that can be read without blocking. Typically, this will be the number of available bytes known to be buffered.

Returns:int

The number of bytes that can be read without blocking

Annotations
@Override
doReadback to summary
public int doRead(ApplicationBufferHandler handler) throws IOException

Implements org.apache.coyote.InputBuffer.doRead.

Fills the given ByteBuffer with the buffered request body.

Parameters
handler:ApplicationBufferHandler

Doc from org.apache.coyote.InputBuffer.doRead.

ApplicationBufferHandler that provides the buffer to read data into.

Returns:int

Doc from org.apache.coyote.InputBuffer.doRead.

The number of bytes that have been added to the buffer or -1 for end of stream

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.coyote.InputBuffer.doRead.

If an I/O error occurs reading from the input stream

endback to summary
public long end() throws IOException

Implements org.apache.coyote.http11.InputFilter.end.

Doc from org.apache.coyote.http11.InputFilter.end.

End the current request.

Returns:long

0 is the expected return value. A positive value indicates that too many bytes were read. This method is allowed to use buffer.doRead to consume extra bytes. The result of this method can't be negative (if an error happens, an IOException should be thrown instead).

Annotations
@Override
Exceptions
IOException:
If an error happens
expandback to summary
public void expand(int size)

Implements org.apache.tomcat.util.net.ApplicationBufferHandler.expand.

Annotations
@Override
getByteBufferback to summary
public ByteBuffer getByteBuffer()

Implements org.apache.tomcat.util.net.ApplicationBufferHandler.getByteBuffer.

Annotations
@Override
getEncodingNameback to summary
public ByteChunk getEncodingName()

Implements org.apache.coyote.http11.InputFilter.getEncodingName.

Doc from org.apache.coyote.http11.InputFilter.getEncodingName.

Get the name of the encoding handled by this filter.

Returns:ByteChunk

The encoding name as a byte chunk to facilitate comparison with the value read from the HTTP headers which will also be a ByteChunk

Annotations
@Override
isFinishedback to summary
public boolean isFinished()

Implements org.apache.coyote.http11.InputFilter.isFinished.

Doc from org.apache.coyote.http11.InputFilter.isFinished.

Has the request body been read fully?

Returns:boolean

true if the request body has been fully read, otherwise false

Annotations
@Override
recycleback to summary
public void recycle()

Implements org.apache.coyote.http11.InputFilter.recycle.

Doc from org.apache.coyote.http11.InputFilter.recycle.

Make the filter ready to process the next request.

Annotations
@Override
setBufferback to summary
public void setBuffer(InputBuffer buffer)

Implements org.apache.coyote.http11.InputFilter.setBuffer.

Doc from org.apache.coyote.http11.InputFilter.setBuffer.

Set the next buffer in the filter pipeline.

Parameters
buffer:InputBuffer

The next buffer

Annotations
@Override
setByteBufferback to summary
public void setByteBuffer(ByteBuffer buffer)

Implements org.apache.tomcat.util.net.ApplicationBufferHandler.setByteBuffer.

Annotations
@Override
setLimitback to summary
public void setLimit(int limit)

Set the buffering limit. This should be reset every time the buffer is used.

Parameters
limit:int

The maximum number of bytes that will be buffered

setRequestback to summary
public void setRequest(Request request)

Implements org.apache.coyote.http11.InputFilter.setRequest.

Reads the request body and buffers it.

Parameters
request:Request

Doc from org.apache.coyote.http11.InputFilter.setRequest.

The request to be associated with this filter

Annotations
@Override