LineParser.
There are individual methods for formatting a request line, a
status line, or a header line. The formatting does not include the
trailing line break sequence CR-LF.
Instances of this interface are expected to be stateless and thread-safe.
The formatted lines are returned in memory, the formatter does not depend
on any specific IO mechanism.
In order to avoid unnecessary creation of temporary objects,
a buffer can be passed as argument to all formatting methods.
The implementation may or may not actually use that buffer for formatting.
If it is used, the buffer will first be cleared by the
formatXXX methods.
The argument buffer can always be re-used after the call. The buffer
returned as the result, if it is different from the argument buffer,
MUST NOT be modified.
| Modifier and Type | Method and Description |
|---|---|
| public CharArrayBuffer | Returns: a buffer with the formatted protocol version appended. The caller is allowed to modify the result buffer. If thebuffer argument is not null,
the returned buffer is the argument buffer.a buffer to which to append, or buffer, ProtocolVersion nullthe protocol version to format version)Formats a protocol version. |
| public CharArrayBuffer | Returns: a buffer holding the formatted header, nevernull.
The returned buffer may be different from the argument buffer.a buffer available for formatting, or
buffer, Header null.
The buffer will be cleared before use.the header to format header)Formats a header. |
| public CharArrayBuffer | Returns: the formatted request linea buffer available for formatting, or
buffer, RequestLine null.
The buffer will be cleared before use.the request line to format reqline)Formats a request line. |
| public CharArrayBuffer | Returns: the formatted status linea buffer available for formatting, or
buffer, StatusLine null.
The buffer will be cleared before use.the status line to format statline)Formats a status line. |
| appendProtocolVersion | back to summary |
|---|---|
| public CharArrayBuffer appendProtocolVersion(CharArrayBuffer buffer, ProtocolVersion version) Formats a protocol version.
This method does not follow the general contract for
| |
| formatHeader | back to summary |
|---|---|
| public CharArrayBuffer formatHeader(CharArrayBuffer buffer, Header header) Formats a header. Due to header continuation, the result may be multiple lines. In order to generate well-formed HTTP, the lines in the result must be separated by the HTTP line break sequence CR-LF. There is no trailing CR-LF in the result. See the class comment for details about the buffer argument.
| |
| formatRequestLine | back to summary |
|---|---|
| public CharArrayBuffer formatRequestLine(CharArrayBuffer buffer, RequestLine reqline) Formats a request line.
| |
| formatStatusLine | back to summary |
|---|---|
| public CharArrayBuffer formatStatusLine(CharArrayBuffer buffer, StatusLine statline) Formats a status line.
| |