A read-only handle to a stream of Chunk, representing the message body.
A read-only handle to a stream of Chunk, representing the message body. This stream is only
populated on chunked messages (isChunked == true
). Use content to access a payload of
a fully-buffered message (isChunked == false
).
Prefer this API over reader when application needs to receive trailing headers (trailers).
Trailers are transmitted in the very last chunk (chunk.isLast == true
) of the stream and
can be retrieved via Chunk.trailers.
Reader and Chunk
A write-only handle to a stream of Chunk, representing the message body.
A write-only handle to a stream of Chunk, representing the message body. Only chunked
messages (isChunked == true
) use this stream as their payload, fully-buffered messages
(isChunked == false
) use content instead.
Prefer this API over writer when application needs to send trailing headers (trailers).
Trailers are transmitted in the very last chunk of the stream and can be populated via
Chunk.last
factory method.
Reader and Chunk
HTTP headers associated with this message.
HTTP headers associated with this message.
HeaderMap isn't thread-safe. Any concurrent access should be synchronized externally.
Trailing headers (trailers) associated with this message.
Trailing headers (trailers) associated with this message.
These are only populated on fully-buffered inbound messages that were aggregated
(see withStreaming(false)
) from HTTP streams terminating with trailers.
HeaderMap isn't thread-safe. Any concurrent access should be synchronized externally.
Accept header
Accept header media types (normalized, no parameters)
Set Accept header with list of values
Set Accept header
Add a cookie
Allow header
Set Authorization header
Set Authorization header
Get Authorization header
Set Authorization header
Get Cache-Control header
Set Cache-Control header with a max-age (and must-revalidate).
Set Cache-Control header
Get charset from Content-Type header
Set charset in Content-Type header.
Set charset in Content-Type header. This does not change the content.
Clear content (set to "").
End the response stream.
Set the content of this Message
.
Set the content of this Message
.
Any existing content is discarded. If this Message
is set to chunked,
an IllegalStateException
is thrown.
content_=(Buf) for Scala users
Retrieve the current content of this Message
.
Retrieve the current content of this Message
.
If this message is chunked, the resulting Buf
will always be empty.
Set Content-Length header.
Set Content-Length header. Normally, this is automatically set by the Codec, but this method allows you to override that.
contentLength_=(Long) for Scala users.
Get the value of the Content-Length header.
Get the value of the Content-Length header. Use length to get the length of actual content.
Long for Java users.
Get the value of the Content-Length header, or the provided default if it doesn't exist.
Get the value of the Content-Length header, or the provided default if it doesn't exist.
Option(Long) for Scala users.
Set Content-Length header.
Set Content-Length header. Normally, this is automatically set by the Codec, but this method allows you to override that.
contentLength(Long) for Java users.
Get the content as a string.
Set the content as a string.
Get Content-Type header
Set Content-Type header
Set the content of this Message
.
Set the content of this Message
.
Any existing content is discarded. If this Message
is set to chunked,
an IllegalStateException
is thrown.
content(Buf) for Java users
Cookies.
Cookies. In a request, this uses the Cookie headers. In a response, it uses the Set-Cookie headers.
Get Date header
Set Date header by Date
Set Date header
Get Expires header
Set Expires header by Date
Set Expires header
Get iterator over Cookies
Get InputStream for content.
Get InputStream for content. Caller must close. (Java interface. Scala users should use withInputStream.)
Get length of content.
Get Reader for content.
Get Reader for content. (Java interface. Scala users should use withReader.)
Set the Host header
Set the Host header
host_=(String) for Scala users
Get Host header
Set Host header
Set Host header
host(String) for Java users
Check if X-Requested-With contains XMLHttpRequest, usually signalling a request from a JavaScript AJAX libraries.
Check if X-Requested-With contains XMLHttpRequest, usually signalling a request from a JavaScript AJAX libraries. Some servers treat these requests specially. For example, an endpoint might render JSON or XML instead HTML if it's an XmlHttpRequest. (Tip: don't do this - it's gross.)
Get Last-Modified header
Set Last-Modified header by Date
Set Last-Modified header
Get length of content.
Get Location header
Set Location header
Get media-type from Content-Type header
Set media-type in Content-Type header.
Set media-type in Content-Type header. Charset and parameter values are preserved, though may not be appropriate for the new media type.
A read-only handle to a stream of Buf, representing the message body.
A read-only handle to a stream of Buf, representing the message body. This stream is only
* populated on chunked messages (isChunked == true
). Use content to access a payload of
a fully-buffered message (isChunked == false
).
Prefer this API over chunkReader when application doesn't need access to trailing headers (trailers).
Reader
Get Referer [sic] header
Set Referer [sic] header
Remove a cookie
Get Retry-After header
Set Retry-After header by seconds
Set Retry-After header
Get Server header
Set Server header
Manipulate the Message
content mode.
Manipulate the Message
content mode.
If chunked
is true
, any existing content will be discarded and further attempts
to manipulate the synchronous content will result in an IllegalStateException
.
If chunked
is false
, the synchronous content methods will become available
and the Reader
/Writer
of the message will be ignored by Finagle.
Set the content as a string.
Set Content-Type header by media-type and charset
Set Content-Type header to application/json;charset=utf-8
Get User-Agent header
Set User-Agent header
Set the HTTP version
Set the HTTP version
* @see version_=(Version) for Scala users
Get the HTTP version
Set the HTTP version
Set the HTTP version
version(Version) for Java users
Use content as InputStream.
Use content as InputStream. The underlying channel buffer's reader index is advanced. (Scala interface. Java users can use getInputStream().)
Append content via an OutputStream.
Append content via an OutputStream.
An IllegalStateException
is thrown if this message is chunked.
Use content as Reader.
Use content as Reader. (Scala interface. Java users can use getReader().)
Append content via a Writer.
Append content via a Writer.
An IllegalStateException
is thrown if this message is chunked.
Append bytes to content.
Append bytes to content.
This method makes a defensive copy of the provided byte array. This can
be avoided by wrapping the byte array via Buf.ByteArray.Owned
and
using the write(Buf)
method.
An IllegalStateException
is thrown if this message is chunked.
Append a Buf to content.
Append a Buf to content.
An IllegalStateException
is thrown if this message is chunked.
Append string to content.
Append string to content.
An IllegalStateException
is thrown if this message is chunked.
A write-only handle to the stream of Buf, representing the message body.
A write-only handle to the stream of Buf, representing the message body. Only chunked
messages (isChunked == true
) use this stream as their payload, fully-buffered messages
(isChunked == false
) use content instead.
Prefer this API over chunkWriter when application doesn't need to send trailing headers (trailers).
Writer
Get WWW-Authenticate header
Set WWW-Authenticate header
Get X-Forwarded-For header
Set X-Forwarded-For header
Rich Message
Base class for Request and Response. There are both input and output methods, though only one set of methods should be used.