Modifier and Type | Class and Description |
---|---|
static class |
HttpParser.EventHandler |
Modifier and Type | Field and Description |
---|---|
protected int |
_chunkLength |
protected int |
_chunkPosition |
protected long |
_contentLength |
protected long |
_contentPosition |
protected View |
_contentView |
protected byte |
_eol |
protected int |
_length |
protected int |
_state |
static int |
STATE_CHUNK |
static int |
STATE_CHUNK_PARAMS |
static int |
STATE_CHUNK_SIZE |
static int |
STATE_CHUNKED_CONTENT |
static int |
STATE_CONTENT |
static int |
STATE_END |
static int |
STATE_END0 |
static int |
STATE_END1 |
static int |
STATE_EOF_CONTENT |
static int |
STATE_FIELD0 |
static int |
STATE_FIELD2 |
static int |
STATE_HEADER |
static int |
STATE_HEADER_IN_NAME |
static int |
STATE_HEADER_IN_VALUE |
static int |
STATE_HEADER_NAME |
static int |
STATE_HEADER_VALUE |
static int |
STATE_SEEKING_EOF |
static int |
STATE_SPACE1 |
static int |
STATE_SPACE2 |
static int |
STATE_START |
static int |
STATE_STATUS |
static int |
STATE_URI |
Constructor and Description |
---|
HttpParser(Buffer buffer,
HttpParser.EventHandler handler)
Constructor.
|
HttpParser(Buffers buffers,
EndPoint endp,
HttpParser.EventHandler handler)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
Buffer |
blockForContent(long maxIdleTime) |
protected int |
fill()
fill the buffers from the endpoint
|
Buffer |
getBodyBuffer() |
long |
getContentLength() |
long |
getContentRead() |
Buffer |
getHeaderBuffer() |
int |
getState() |
boolean |
inContentState() |
boolean |
inHeaderState() |
boolean |
isChunking() |
boolean |
isComplete() |
boolean |
isIdle() |
boolean |
isMoreInBuffer() |
boolean |
isPersistent() |
boolean |
isState(int state) |
void |
parse()
Parse until
END state. |
boolean |
parseAvailable()
Parse until END state.
|
int |
parseNext()
Parse until next Event.
|
void |
reset() |
void |
returnBuffers() |
void |
setForceContentBuffer(boolean force) |
void |
setHeadResponse(boolean head)
Set if a HEAD response is expected
|
void |
setPersistent(boolean persistent) |
void |
setState(int state) |
String |
toString() |
String |
toString(Buffer buf) |
public static final int STATE_START
public static final int STATE_FIELD0
public static final int STATE_SPACE1
public static final int STATE_STATUS
public static final int STATE_URI
public static final int STATE_SPACE2
public static final int STATE_END0
public static final int STATE_END1
public static final int STATE_FIELD2
public static final int STATE_HEADER
public static final int STATE_HEADER_NAME
public static final int STATE_HEADER_IN_NAME
public static final int STATE_HEADER_VALUE
public static final int STATE_HEADER_IN_VALUE
public static final int STATE_END
public static final int STATE_EOF_CONTENT
public static final int STATE_CONTENT
public static final int STATE_CHUNKED_CONTENT
public static final int STATE_CHUNK_SIZE
public static final int STATE_CHUNK_PARAMS
public static final int STATE_CHUNK
public static final int STATE_SEEKING_EOF
protected final View _contentView
protected int _state
protected byte _eol
protected int _length
protected long _contentLength
protected long _contentPosition
protected int _chunkLength
protected int _chunkPosition
public HttpParser(Buffer buffer, HttpParser.EventHandler handler)
public HttpParser(Buffers buffers, EndPoint endp, HttpParser.EventHandler handler)
buffers
- the buffers to useendp
- the endpointhandler
- the even handlerpublic long getContentLength()
public long getContentRead()
public void setHeadResponse(boolean head)
head
- public int getState()
public boolean inContentState()
public boolean inHeaderState()
public boolean isChunking()
public boolean isComplete()
isComplete
in interface Parser
public boolean isMoreInBuffer() throws IOException
isMoreInBuffer
in interface Parser
IOException
public boolean isState(int state)
public boolean isPersistent()
isPersistent
in interface Parser
public void setPersistent(boolean persistent)
setPersistent
in interface Parser
public void parse() throws IOException
IllegalStateException
- If the buffers have already been partially parsed.IOException
public boolean parseAvailable() throws IOException
current state
of the parser.parseAvailable
in interface Parser
IOException
parse()
,
parseNext()
public int parseNext() throws IOException
IOException
protected int fill() throws IOException
IOException
public void returnBuffers()
returnBuffers
in interface Parser
public void setState(int state)
public Buffer getHeaderBuffer()
public Buffer getBodyBuffer()
public void setForceContentBuffer(boolean force)
force
- True if a new buffer will be forced to be used for content and the header buffer will not be used.public Buffer blockForContent(long maxIdleTime) throws IOException
IOException
public int available() throws IOException
IOException
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.