Note
This class was created by refactoring parsing code located in various other classes. The author tags from those other classes have been replicated here, although the association with the parsing code taken from there has not been traced.
| Modifier and Type | Field and Description |
|---|---|
| public static final BasicLineParser | DEFAULT
A default instance of this class, for use as default or fallback. |
| public static final BasicLineParser | |
| protected final ProtocolVersion | protocol
A version of the protocol to parse. |
| Access | Constructor and Description |
|---|---|
| public | BasicLineParser(final ProtocolVersion
a version of the protocol to parse, or
proto)null for HTTP. The actual version
is not relevant, only the protocol name.Creates a new line parser for the given HTTP-like protocol. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected ProtocolVersion | Returns: the protocol versionthe major version number, for example 1 in HTTP/1.0 major, final int the minor version number, for example 0 in HTTP/1.0 minor)Creates a protocol version. |
| protected RequestLine | Returns: a new status line with the given datathe request method method, final String the requested URI uri, final ProtocolVersion the protocol version ver)Instantiates a new request line. |
| protected StatusLine | Returns: a new status line with the given datathe protocol version ver, final int the status code status, final String the reason phrase reason)Instantiates a new status line. |
| public boolean | hasProtocolVersion(final CharArrayBuffer
a buffer holding the line to inspect buffer, final ParserCursor 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. cursor)Implements org. |
| public static Header | |
| public Header | parseHeader(final CharArrayBuffer
a buffer holding the full header line.
This buffer MUST NOT be re-used afterwards, since
the returned object may reference the contents later. buffer)Implements org. |
| public static ProtocolVersion | |
| public ProtocolVersion | parseProtocolVersion(final CharArrayBuffer
a buffer holding the protocol version to parse buffer, final ParserCursor the parser cursor containing the current position and
the bounds within the buffer for the parsing operation cursor)Implements org. |
| public static RequestLine | |
| public RequestLine | Returns: the parsed request linea buffer holding the line to parse buffer, final ParserCursor the parser cursor containing the current position and
the bounds within the buffer for the parsing operation cursor)Implements org. |
| public static StatusLine | |
| public StatusLine | parseStatusLine(final CharArrayBuffer
a buffer holding the line to parse buffer, final ParserCursor the parser cursor containing the current position and
the bounds within the buffer for the parsing operation cursor)Implements org. |
| protected void |
| DEFAULT | back to summary |
|---|---|
| public static final BasicLineParser DEFAULT
Deprecated (4.3) use A default instance of this class, for use as default or fallback.
Note that | |
| INSTANCE | back to summary |
|---|---|
| public static final BasicLineParser INSTANCE | |
| protocol | back to summary |
|---|---|
| protected final ProtocolVersion protocol A version of the protocol to parse. The version is typically not relevant, but the protocol name. | |
| BasicLineParser | back to summary |
|---|---|
| public BasicLineParser(final ProtocolVersion proto) Creates a new line parser for the given HTTP-like protocol.
| |
| BasicLineParser | back to summary |
|---|---|
| public BasicLineParser() Creates a new line parser for HTTP. | |
| createProtocolVersion | back to summary |
|---|---|
| protected ProtocolVersion createProtocolVersion(final int major, final int minor) Creates a protocol version.
Called from
| |
| createRequestLine | back to summary |
|---|---|
| protected RequestLine createRequestLine(final String method, final String uri, final ProtocolVersion ver) Instantiates a new request line.
Called from
| |
| createStatusLine | back to summary |
|---|---|
| protected StatusLine createStatusLine(final ProtocolVersion ver, final int status, final String reason) Instantiates a new status line.
Called from
| |
| hasProtocolVersion | back to summary |
|---|---|
| public boolean hasProtocolVersion(final CharArrayBuffer buffer, final ParserCursor cursor) Implements org. Doc from org. Checks whether there likely is a protocol version in a line.
This method implements a heuristic to check for a
likely protocol version specification. It does not
guarantee that
| |
| parseHeader | back to summary |
|---|---|
| public static Header parseHeader(final String value, final LineParser parser) throws ParseException | |
| parseHeader | back to summary |
|---|---|
| public Header parseHeader(final CharArrayBuffer buffer) throws ParseException Implements org. Doc from org. Creates a header from a line. The full header line is expected here. Header continuation lines must be joined by the caller before invoking this method.
| |
| parseProtocolVersion | back to summary |
|---|---|
| public static ProtocolVersion parseProtocolVersion(final String value, final LineParser parser) throws ParseException | |
| parseProtocolVersion | back to summary |
|---|---|
| public ProtocolVersion parseProtocolVersion(final CharArrayBuffer buffer, final ParserCursor cursor) throws ParseException Implements org. Doc from org. Parses the textual representation of a protocol version. This is needed for parsing request lines (last element) as well as status lines (first element).
| |
| parseRequestLine | back to summary |
|---|---|
| public static RequestLine parseRequestLine(final String value, final LineParser parser) throws ParseException | |
| parseRequestLine | back to summary |
|---|---|
| public RequestLine parseRequestLine(final CharArrayBuffer buffer, final ParserCursor cursor) throws ParseException Implements org. Parses a request line.
| |
| parseStatusLine | back to summary |
|---|---|
| public static StatusLine parseStatusLine(final String value, final LineParser parser) throws ParseException | |
| parseStatusLine | back to summary |
|---|---|
| public StatusLine parseStatusLine(final CharArrayBuffer buffer, final ParserCursor cursor) throws ParseException Implements org. Doc from org. Parses a status line.
| |
| skipWhitespace | back to summary |
|---|---|
| protected void skipWhitespace(final CharArrayBuffer buffer, final ParserCursor cursor) Helper to skip whitespace. | |