public interface HttpResponse extends HttpResponseMetaData
Object
.Modifier and Type | Method and Description |
---|---|
default HttpResponse |
addCookie(java.lang.CharSequence name,
java.lang.CharSequence value)
|
default HttpResponse |
addCookie(HttpCookiePair cookie)
Adds a cookie.
|
default HttpResponse |
addHeader(java.lang.CharSequence name,
java.lang.CharSequence value)
Adds a new header with the specified
name and value . |
default HttpResponse |
addHeaders(HttpHeaders headers)
Adds all header names and values of
headers object. |
default HttpResponse |
addSetCookie(java.lang.CharSequence name,
java.lang.CharSequence value)
|
default HttpResponse |
addSetCookie(HttpSetCookie cookie)
Adds a set-cookie.
|
default HttpResponse |
addTrailer(java.lang.CharSequence name,
java.lang.CharSequence value)
Adds a new trailer with the specified
name and value . |
default HttpResponse |
addTrailers(HttpHeaders trailers)
Adds all trailer names and values of
trailer object. |
Buffer |
payloadBody()
Gets the underlying payload as a
Buffer . |
HttpResponse |
payloadBody(Buffer payloadBody)
Returns an
HttpResponse with its underlying payload set to payloadBody . |
default <T> T |
payloadBody(HttpDeserializer<T> deserializer)
Gets and deserializes the payload body.
|
<T> HttpResponse |
payloadBody(T pojo,
HttpSerializer<T> serializer)
Returns an
HttpResponse with its underlying payload set to the results of serialization of pojo . |
default HttpResponse |
setHeader(java.lang.CharSequence name,
java.lang.CharSequence value)
Sets a header with the specified
name and value . |
default HttpResponse |
setHeaders(HttpHeaders headers)
Clears the current header entries and copies all header entries of the specified
headers object. |
default HttpResponse |
setTrailer(java.lang.CharSequence name,
java.lang.CharSequence value)
Sets a trailer with the specified
name and value . |
default HttpResponse |
setTrailers(HttpHeaders trailers)
Clears the current trailer entries and copies all trailer entries of the specified
trailers object. |
HttpResponse |
status(HttpResponseStatus status)
Set the status of this
StreamingHttpResponse . |
BlockingStreamingHttpResponse |
toBlockingStreamingResponse()
Translates this
HttpResponse to a BlockingStreamingHttpResponse . |
StreamingHttpResponse |
toStreamingResponse()
Translates this
HttpResponse to a StreamingHttpResponse . |
HttpHeaders |
trailers()
Gets the trailers.
|
HttpResponse |
version(HttpProtocolVersion version)
Set the protocol version of this
HttpMetaData . |
status
headers, toString, toString, version
Buffer payloadBody()
Buffer
.Buffer
representation of the underlying payload.default <T> T payloadBody(HttpDeserializer<T> deserializer)
T
- The resulting type of the deserialization operation.deserializer
- The function that deserializes the underlying Object
.HttpResponse payloadBody(Buffer payloadBody)
HttpResponse
with its underlying payload set to payloadBody
.payloadBody
- the underlying payload.this
<T> HttpResponse payloadBody(T pojo, HttpSerializer<T> serializer)
HttpResponse
with its underlying payload set to the results of serialization of pojo
.T
- The type of object to serialize.pojo
- The object to serialize.serializer
- The HttpSerializer
which converts pojo
into bytes.this
StreamingHttpResponse toStreamingResponse()
HttpResponse
to a StreamingHttpResponse
.StreamingHttpResponse
representation of this HttpResponse
.BlockingStreamingHttpResponse toBlockingStreamingResponse()
HttpResponse
to a BlockingStreamingHttpResponse
.BlockingStreamingHttpResponse
representation of this HttpResponse
.HttpResponse version(HttpProtocolVersion version)
HttpMetaData
HttpMetaData
.version
in interface HttpMetaData
version
in interface HttpResponseMetaData
version
- the protocol version to set.this
.HttpResponse status(HttpResponseStatus status)
HttpResponseMetaData
StreamingHttpResponse
.status
in interface HttpResponseMetaData
status
- The HttpResponseStatus
to set.this
.default HttpResponse addHeader(java.lang.CharSequence name, java.lang.CharSequence value)
HttpMetaData
name
and value
.addHeader
in interface HttpMetaData
addHeader
in interface HttpResponseMetaData
name
- the name of the header.value
- the value of the header.this
.default HttpResponse addHeaders(HttpHeaders headers)
HttpMetaData
headers
object.addHeaders
in interface HttpMetaData
addHeaders
in interface HttpResponseMetaData
headers
- the headers to add.this
.default HttpResponse setHeader(java.lang.CharSequence name, java.lang.CharSequence value)
HttpMetaData
name
and value
. Any existing headers with the same name are
overwritten.setHeader
in interface HttpMetaData
setHeader
in interface HttpResponseMetaData
name
- the name of the header.value
- the value of the header.this
.default HttpResponse setHeaders(HttpHeaders headers)
HttpMetaData
headers
object.setHeaders
in interface HttpMetaData
setHeaders
in interface HttpResponseMetaData
headers
- the headers object which contains new values.this
.default HttpResponse addCookie(HttpCookiePair cookie)
HttpMetaData
This may result in multiple HttpCookiePair
s with same name.
addCookie
in interface HttpMetaData
addCookie
in interface HttpResponseMetaData
cookie
- the cookie to add.this
.default HttpResponse addCookie(java.lang.CharSequence name, java.lang.CharSequence value)
HttpMetaData
name
and
value
.
This may result in multiple HttpSetCookie
s with same name. Added cookie will not be wrapped, not secure,
and not HTTP-only, with no path, domain, expire date and maximum age.
addCookie
in interface HttpMetaData
addCookie
in interface HttpResponseMetaData
name
- the name of the cookie.value
- the value of the cookie.this
.default HttpResponse addSetCookie(HttpSetCookie cookie)
HttpMetaData
This may result in multiple HttpSetCookie
s with same name.
addSetCookie
in interface HttpMetaData
addSetCookie
in interface HttpResponseMetaData
cookie
- the cookie to add.this
.default HttpResponse addSetCookie(java.lang.CharSequence name, java.lang.CharSequence value)
HttpMetaData
name
and value
.
This may result in multiple HttpSetCookie
s with same name. Added cookie will not be wrapped, not secure,
and not HTTP-only, with no path, domain, expire date and maximum age.
addSetCookie
in interface HttpMetaData
addSetCookie
in interface HttpResponseMetaData
name
- the name of the cookie.value
- the value of the cookie.this
.default HttpResponse addTrailer(java.lang.CharSequence name, java.lang.CharSequence value)
name
and value
.name
- the name of the trailer.value
- the value of the trailer.this
.default HttpResponse addTrailers(HttpHeaders trailers)
trailer
object.trailers
- the trailers to add.this
.default HttpResponse setTrailer(java.lang.CharSequence name, java.lang.CharSequence value)
name
and value
. Any existing trailers with the same name are
overwritten.name
- the name of the trailer.value
- the value of the trailer.this
.default HttpResponse setTrailers(HttpHeaders trailers)
trailers
object.trailers
- the trailers object which contains new values.this
.HttpHeaders trailers()