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

public Class IdentityInputFilter

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.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

Identity input filter.
Author
Remy Maucherat

Field Summary

Modifier and TypeField and Description
protected InputBuffer
buffer

Next buffer in the pipeline.

protected long
contentLength

Content length.

protected static final ByteChunk
protected static final String
private final int
protected long
remaining

Remaining bytes.

private static final StringManager
protected ByteBuffer
tempRead

ByteBuffer used to read leftover bytes.

Constructor Summary

AccessConstructor and Description
public
IdentityInputFilter(int maxSwallowSize)

Method Summary

Modifier and TypeMethod and Description
public int
available()

Implements org.apache.coyote.InputBuffer.available.

Amount of bytes still available in a buffer.

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

Implements org.apache.coyote.InputBuffer.doRead.

Read from the input stream into the ByteBuffer provided by the ApplicationBufferHandler.

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.

Return the name of the associated encoding; Here, the value is "identity".

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
setRequest(Request
The request to be associated with this filter
request
)

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

Read the content length from the request.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
protected InputBuffer buffer

Next buffer in the pipeline.

contentLengthback to summary
protected long contentLength

Content length.

ENCODINGback to summary
protected static final ByteChunk ENCODING
ENCODING_NAMEback to summary
protected static final String ENCODING_NAME
maxSwallowSizeback to summary
private final int maxSwallowSize
remainingback to summary
protected long remaining

Remaining bytes.

smback to summary
private static final StringManager sm
tempReadback to summary
protected ByteBuffer tempRead

ByteBuffer used to read leftover bytes.

Constructor Detail

IdentityInputFilterback to summary
public IdentityInputFilter(int maxSwallowSize)

Method Detail

availableback to summary
public int available()

Implements org.apache.coyote.InputBuffer.available.

Amount of bytes still available in a buffer.

Returns:int

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

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.

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

Read from the input stream into the ByteBuffer provided by the ApplicationBufferHandler.

Important Note

the current model assumes that the protocol will 'own' the ByteBuffer and return a pointer to it.

Parameters
handler:ApplicationBufferHandler

ApplicationBufferHandler that provides the buffer to read data into.

Returns:int

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

Annotations
@Override
Exceptions
IOException:
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.

Return the name of the associated encoding; Here, the value is "identity".

Returns:ByteChunk

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

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.

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.

Set the next buffer in the filter pipeline.

Parameters
buffer:InputBuffer

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

The next buffer

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

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

Annotations
@Override
setRequestback to summary
public void setRequest(Request request)

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

Read the content length from the request.

Parameters
request:Request

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

The request to be associated with this filter

Annotations
@Override