org.apache.coyote.http11
public class InternalNioInputBuffer extends java.lang.Object implements InputBuffer
Modifier and Type | Class and Description |
---|---|
static class |
InternalNioInputBuffer.HeaderParseData |
protected class |
InternalNioInputBuffer.SocketInputBuffer
This class is an input buffer which will read its data from an input
stream.
|
Modifier and Type | Field and Description |
---|---|
protected InputFilter[] |
activeFilters
Active filters (in order).
|
protected byte[] |
buf
Pointer to the current read buffer.
|
protected int |
end
Pos of the end of the header in the buffer, which is also the
start of the body.
|
protected InputFilter[] |
filterLibrary
Filter library.
|
protected InternalNioInputBuffer.HeaderParseData |
headerData |
protected org.apache.coyote.http11.InternalNioInputBuffer.HeaderParsePosition |
headerParsePos |
protected MimeHeaders |
headers
Headers of the associated request.
|
protected InputBuffer |
inputStreamInputBuffer
Underlying input buffer.
|
protected int |
lastActiveFilter
Index of the last active filter.
|
protected int |
lastValid
Last valid byte.
|
protected boolean |
parsingHeader
Parsing state - used for non blocking parsing so that
when more data arrives, we can pick up where we left off.
|
protected boolean |
parsingRequestLine |
protected boolean |
parsingRequestLineEol |
protected int |
parsingRequestLinePhase |
protected int |
parsingRequestLineQPos |
protected int |
parsingRequestLineStart |
protected NioSelectorPool |
pool
Selector pool, for blocking reads and blocking writes
|
protected int |
pos
Position in the buffer.
|
protected Request |
request
Associated Coyote request.
|
protected static StringManager |
sm
The string manager for this package.
|
protected NioChannel |
socket
Underlying socket.
|
protected boolean |
swallowInput
Swallow input ?
|
Constructor and Description |
---|
InternalNioInputBuffer(Request request,
int headerBufferSize)
Alternate constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addActiveFilter(InputFilter filter)
Add an input filter to the filter library.
|
void |
addFilter(InputFilter filter)
Add an input filter to the filter library.
|
int |
available()
Available bytes (note that due to encoding, this may not correspond )
|
void |
clearFilters()
Clear filters.
|
int |
doRead(ByteChunk chunk,
Request req)
Read some bytes.
|
void |
endRequest()
End request (consumes leftover bytes).
|
protected boolean |
fill(boolean timeout,
boolean block)
Fill the internal buffer using data from the undelying input stream.
|
InputFilter[] |
getFilters()
Get filters.
|
NioSelectorPool |
getSelectorPool() |
NioChannel |
getSocket()
Get the underlying socket input stream.
|
boolean |
isReadable()
Returns true if there are bytes available from the socket layer
|
int |
nbRead()
Issues a non blocking read
|
void |
nextRequest()
End processing of current HTTP request.
|
org.apache.coyote.http11.InternalNioInputBuffer.HeaderParseStatus |
parseHeader()
Parse an HTTP header.
|
boolean |
parseHeaders()
Parse the HTTP headers.
|
boolean |
parseRequestLine(boolean useAvailableData)
Read the request line.
|
void |
recycle()
Recycle the input buffer.
|
void |
setSelectorPool(NioSelectorPool pool) |
void |
setSocket(NioChannel socket)
Set the underlying socket.
|
void |
setSwallowInput(boolean swallowInput)
Set the swallow input flag.
|
protected static StringManager sm
protected Request request
protected MimeHeaders headers
protected boolean parsingHeader
protected boolean parsingRequestLine
protected int parsingRequestLinePhase
protected boolean parsingRequestLineEol
protected int parsingRequestLineStart
protected int parsingRequestLineQPos
protected org.apache.coyote.http11.InternalNioInputBuffer.HeaderParsePosition headerParsePos
protected boolean swallowInput
protected byte[] buf
protected int lastValid
protected int pos
protected int end
protected NioChannel socket
protected NioSelectorPool pool
protected InputBuffer inputStreamInputBuffer
protected InputFilter[] filterLibrary
protected InputFilter[] activeFilters
protected int lastActiveFilter
protected InternalNioInputBuffer.HeaderParseData headerData
public InternalNioInputBuffer(Request request, int headerBufferSize)
public void setSocket(NioChannel socket)
public NioChannel getSocket()
public void setSelectorPool(NioSelectorPool pool)
public NioSelectorPool getSelectorPool()
public void addFilter(InputFilter filter)
public InputFilter[] getFilters()
public void clearFilters()
public void addActiveFilter(InputFilter filter)
public void setSwallowInput(boolean swallowInput)
public boolean isReadable() throws java.io.IOException
java.io.IOException
public int nbRead() throws java.io.IOException
java.io.IOException
public void recycle()
public void nextRequest()
public void endRequest() throws java.io.IOException
java.io.IOException
- an undelying I/O error occuredpublic boolean parseRequestLine(boolean useAvailableData) throws java.io.IOException
java.io.IOException
- If an exception occurs during the underlying socket
read operations, or if the given buffer is not big enough to accomodate
the whole line.public boolean parseHeaders() throws java.io.IOException
java.io.IOException
public org.apache.coyote.http11.InternalNioInputBuffer.HeaderParseStatus parseHeader() throws java.io.IOException
java.io.IOException
public int available()
public int doRead(ByteChunk chunk, Request req) throws java.io.IOException
doRead
in interface InputBuffer
java.io.IOException
protected boolean fill(boolean timeout, boolean block) throws java.io.IOException, java.io.EOFException
java.io.IOException
java.io.EOFException
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.