java.lang.Object | |
↳ | org.apache.http.message.BasicLineFormatter |
Interface for formatting elements of the HEAD section of an HTTP message.
This is the complement to 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.
The formatted lines are returned in memory, the formatter does not depend
on any specific IO mechanism.
Instances of this interface are expected to be stateless and thread-safe.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BasicLineFormatter | DEFAULT | A default instance of this class, for use as default or fallback. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Formats a protocol version.
| |||||||||||
Formats a header.
| |||||||||||
Formats a header.
| |||||||||||
Formats a protocol version.
| |||||||||||
Formats a request line.
| |||||||||||
Formats a request line.
| |||||||||||
Formats a status line.
| |||||||||||
Formats a status line.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Actually formats a header.
| |||||||||||
Actually formats a request line.
| |||||||||||
Actually formats a status line.
| |||||||||||
Guesses the length of a formatted protocol version.
| |||||||||||
Obtains a buffer for formatting.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
From interface org.apache.http.message.LineFormatter
|
A default instance of this class, for use as default or fallback.
Note that BasicLineFormatter
is not a singleton, there can
be many instances of the class itself and of derived classes.
The instance here provides non-customized, default behavior.
Formats a protocol version.
This method does not follow the general contract for
buffer
arguments.
It does not clear the argument buffer, but appends instead.
The returned buffer can always be modified by the caller.
Because of these differing conventions, it is not named
formatProtocolVersion
.
buffer | a buffer to which to append, or null |
---|---|
version | the protocol version to format |
buffer
argument is not null
,
the returned buffer is the argument buffer.
Formats a header.
header | the header to format |
---|---|
formatter | the formatter to use, or
null for the
default |
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.
buffer | a buffer available for formatting, or
null .
The buffer will be cleared before use. |
---|---|
header | the header to format |
null
.
The returned buffer may be different from the argument buffer.Formats a protocol version.
version | the protocol version to format |
---|---|
formatter | the formatter to use, or
null for the
default |
Formats a request line.
buffer | a buffer available for formatting, or
null .
The buffer will be cleared before use. |
---|---|
reqline | the request line to format |
Formats a request line.
reqline | the request line to format |
---|---|
formatter | the formatter to use, or
null for the
default |
Formats a status line.
statline | the status line to format |
---|---|
formatter | the formatter to use, or
null for the
default |
Formats a status line.
buffer | a buffer available for formatting, or
null .
The buffer will be cleared before use. |
---|---|
statline | the status line to format |
Actually formats a header.
Called from formatHeader(Header, LineFormatter)
.
buffer | the empty buffer into which to format,
never null |
---|---|
header | the header to format, never null
|
Actually formats a request line.
Called from formatRequestLine(RequestLine, LineFormatter)
.
buffer | the empty buffer into which to format,
never null |
---|---|
reqline | the request line to format, never null
|
Actually formats a status line.
Called from formatStatusLine(StatusLine, LineFormatter)
.
buffer | the empty buffer into which to format,
never null |
---|---|
statline | the status line to format, never null
|
Guesses the length of a formatted protocol version. Needed to guess the length of a formatted request or status line.
version | the protocol version to format, or null |
---|
Obtains a buffer for formatting.
buffer | a buffer already available, or null |
---|