|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LineParser
Interface for parsing lines in the HEAD section of an HTTP message. There are individual methods for parsing a request line, a status line, or a header line. The lines to parse are passed in memory, the parser does not depend on any specific IO mechanism. Instances of this interface are expected to be stateless and thread-safe.
Method Summary | |
---|---|
boolean |
hasProtocolVersion(CharArrayBuffer buffer,
ParserCursor cursor)
Checks whether there likely is a protocol version in a line. |
Header |
parseHeader(CharArrayBuffer buffer)
Creates a header from a line. |
ProtocolVersion |
parseProtocolVersion(CharArrayBuffer buffer,
ParserCursor cursor)
Parses the textual representation of a protocol version. |
RequestLine |
parseRequestLine(CharArrayBuffer buffer,
ParserCursor cursor)
Parses a request line. |
StatusLine |
parseStatusLine(CharArrayBuffer buffer,
ParserCursor cursor)
Parses a status line. |
Method Detail |
---|
ProtocolVersion parseProtocolVersion(CharArrayBuffer buffer, ParserCursor cursor) throws ParseException
buffer
- a buffer holding the protocol version to parsecursor
- the parser cursor containing the current position and
the bounds within the buffer for the parsing operation
ParseException
- in case of a parse errorboolean hasProtocolVersion(CharArrayBuffer buffer, ParserCursor cursor)
parseProtocolVersion(org.apache.http.util.CharArrayBuffer, org.apache.http.message.ParserCursor)
would not
detect a parse error.
This can be used to detect garbage lines before a request
or status line.
buffer
- a buffer holding the line to inspectcursor
- the cursor at which to check for a protocol version, or
negative for "end of line". Whether the check tolerates
whitespace before or after the protocol version is
implementation dependent.
true
if there is a protocol version at the
argument index (possibly ignoring whitespace),
false
otherwiseRequestLine parseRequestLine(CharArrayBuffer buffer, ParserCursor cursor) throws ParseException
buffer
- a buffer holding the line to parsecursor
- the parser cursor containing the current position and
the bounds within the buffer for the parsing operation
ParseException
- in case of a parse errorStatusLine parseStatusLine(CharArrayBuffer buffer, ParserCursor cursor) throws ParseException
buffer
- a buffer holding the line to parsecursor
- the parser cursor containing the current position and
the bounds within the buffer for the parsing operation
ParseException
- in case of a parse errorHeader parseHeader(CharArrayBuffer buffer) throws ParseException
buffer
- a buffer holding the full header line.
This buffer MUST NOT be re-used afterwards, since
the returned object may reference the contents later.
ParseException
- in case of a parse error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |