public interface StreamingHttpResponse extends HttpResponseMetaData
HttpResponse
but provides the payload as a Publisher
.Modifier and Type | Method and Description |
---|---|
default StreamingHttpResponse |
addCookie(java.lang.CharSequence name,
java.lang.CharSequence value)
|
default StreamingHttpResponse |
addCookie(HttpCookiePair cookie)
Adds a cookie.
|
default StreamingHttpResponse |
addHeader(java.lang.CharSequence name,
java.lang.CharSequence value)
Adds a new header with the specified
name and value . |
default StreamingHttpResponse |
addHeaders(HttpHeaders headers)
Adds all header names and values of
headers object. |
default StreamingHttpResponse |
addSetCookie(java.lang.CharSequence name,
java.lang.CharSequence value)
|
default StreamingHttpResponse |
addSetCookie(HttpSetCookie cookie)
Adds a set-cookie.
|
Publisher<Buffer> |
payloadBody()
|
default <T> Publisher<T> |
payloadBody(HttpDeserializer<T> deserializer)
Gets and deserializes the payload body.
|
StreamingHttpResponse |
payloadBody(Publisher<Buffer> payloadBody)
Returns a
StreamingHttpResponse with its underlying payload set to payloadBody . |
<T> StreamingHttpResponse |
payloadBody(Publisher<T> payloadBody,
HttpSerializer<T> serializer)
Returns a
StreamingHttpResponse with its underlying payload set to the result of serialization. |
Publisher<java.lang.Object> |
payloadBodyAndTrailers()
|
default StreamingHttpResponse |
setHeader(java.lang.CharSequence name,
java.lang.CharSequence value)
Sets a header with the specified
name and value . |
default StreamingHttpResponse |
setHeaders(HttpHeaders headers)
Clears the current header entries and copies all header entries of the specified
headers object. |
BlockingStreamingHttpResponse |
toBlockingStreamingResponse()
Translates this
StreamingHttpResponse to a BlockingStreamingHttpResponse . |
Single<HttpResponse> |
toResponse()
Translates this
StreamingHttpResponse to a HttpResponse . |
<T> StreamingHttpResponse |
transform(TrailersTransformer<T,Buffer> trailersTransformer)
Returns a
StreamingHttpResponse with its underlying payload transformed to Buffer s,
with access to the trailers. |
<T> StreamingHttpResponse |
transformPayloadBody(java.util.function.Function<Publisher<Buffer>,Publisher<T>> transformer,
HttpSerializer<T> serializer)
Returns a
StreamingHttpResponse with its underlying payload transformed to the result of serialization. |
default <T,R> StreamingHttpResponse |
transformPayloadBody(java.util.function.Function<Publisher<T>,Publisher<R>> transformer,
HttpDeserializer<T> deserializer,
HttpSerializer<R> serializer)
Returns a
StreamingHttpResponse with its underlying payload transformed to the result of serialization. |
StreamingHttpResponse |
transformPayloadBody(java.util.function.UnaryOperator<Publisher<Buffer>> transformer)
Returns a
StreamingHttpResponse with its underlying payload transformed to Buffer s. |
<T> StreamingHttpResponse |
transformRaw(TrailersTransformer<T,java.lang.Object> trailersTransformer)
Returns a
StreamingHttpResponse with its underlying payload transformed to Object s,
with access to the trailers. |
StreamingHttpResponse |
transformRawPayloadBody(java.util.function.UnaryOperator<Publisher<?>> transformer)
Returns a
StreamingHttpResponse with its underlying payload transformed. |
StreamingHttpResponse |
version(HttpProtocolVersion version)
Set the protocol version of this
HttpMetaData . |
status, status
headers, toString, toString, version
default <T> Publisher<T> payloadBody(HttpDeserializer<T> deserializer)
T
- The resulting type of the deserialization operation.deserializer
- The function that deserializes the underlying Publisher
.Publisher<java.lang.Object> payloadBodyAndTrailers()
StreamingHttpResponse payloadBody(Publisher<Buffer> payloadBody)
StreamingHttpResponse
with its underlying payload set to payloadBody
.
A best effort will be made to apply back pressure to the existing Publisher
payload body. If this default
policy is not sufficient you can use transformPayloadBody(UnaryOperator)
for more fine grain control.
This method reserves the right to delay completion/consumption of payloadBody
. This may occur due to the
combination with the existing Publisher
payload body.
payloadBody
- The new payload body.this
<T> StreamingHttpResponse payloadBody(Publisher<T> payloadBody, HttpSerializer<T> serializer)
StreamingHttpResponse
with its underlying payload set to the result of serialization.
A best effort will be made to apply back pressure to the existing Publisher
payload body. If this default
policy is not sufficient you can use transformPayloadBody(Function, HttpSerializer)
for more fine grain
control.
This method reserves the right to delay completion/consumption of payloadBody
. This may occur due to the
combination with the existing Publisher
payload body.
T
- The type of objects to serialize.payloadBody
- The new payload body, prior to serialization.serializer
- Used to serialize the payload body.this
<T> StreamingHttpResponse transformPayloadBody(java.util.function.Function<Publisher<Buffer>,Publisher<T>> transformer, HttpSerializer<T> serializer)
StreamingHttpResponse
with its underlying payload transformed to the result of serialization.T
- The type of objects to serialize.transformer
- A Function
which take as a parameter the existing payload body Publisher
and
returns the new payload body Publisher
prior to serialization. It is assumed the existing payload body
Publisher
will be transformed/consumed or else no more responses may be processed.serializer
- Used to serialize the payload body.this
default <T,R> StreamingHttpResponse transformPayloadBody(java.util.function.Function<Publisher<T>,Publisher<R>> transformer, HttpDeserializer<T> deserializer, HttpSerializer<R> serializer)
StreamingHttpResponse
with its underlying payload transformed to the result of serialization.T
- The type of objects to deserialize.R
- The type of objects to serialize.transformer
- A Function
which take as a parameter the existing payload body Publisher
and
returns the new payload body Publisher
prior to serialization. It is assumed the existing payload body
Publisher
will be transformed/consumed or else no more requests may be processed.deserializer
- Used to deserialize the existing payload body.serializer
- Used to serialize the payload body.this
StreamingHttpResponse transformPayloadBody(java.util.function.UnaryOperator<Publisher<Buffer>> transformer)
StreamingHttpResponse
with its underlying payload transformed to Buffer
s.StreamingHttpResponse transformRawPayloadBody(java.util.function.UnaryOperator<Publisher<?>> transformer)
StreamingHttpResponse
with its underlying payload transformed. Note that the raw objects of the
underlying Publisher
may be exposed. The object types are not guaranteed to be homogeneous.transformer
- Responsible for transforming the payload body.this
<T> StreamingHttpResponse transform(TrailersTransformer<T,Buffer> trailersTransformer)
StreamingHttpResponse
with its underlying payload transformed to Buffer
s,
with access to the trailers.T
- The type of state used during the transformation.trailersTransformer
- TrailersTransformer
to use for this transform.this
<T> StreamingHttpResponse transformRaw(TrailersTransformer<T,java.lang.Object> trailersTransformer)
StreamingHttpResponse
with its underlying payload transformed to Object
s,
with access to the trailers.T
- The type of state used during the transformation.trailersTransformer
- TrailersTransformer
to use for this transform.this
Single<HttpResponse> toResponse()
StreamingHttpResponse
to a HttpResponse
.Single
that completes with a HttpResponse
representation of this
StreamingHttpResponse
.BlockingStreamingHttpResponse toBlockingStreamingResponse()
StreamingHttpResponse
to a BlockingStreamingHttpResponse
.BlockingStreamingHttpResponse
representation of this StreamingHttpResponse
.StreamingHttpResponse version(HttpProtocolVersion version)
HttpMetaData
HttpMetaData
.version
in interface HttpMetaData
version
in interface HttpResponseMetaData
version
- the protocol version to set.this
.default StreamingHttpResponse 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 StreamingHttpResponse addHeaders(HttpHeaders headers)
HttpMetaData
headers
object.addHeaders
in interface HttpMetaData
addHeaders
in interface HttpResponseMetaData
headers
- the headers to add.this
.default StreamingHttpResponse 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 StreamingHttpResponse setHeaders(HttpHeaders headers)
HttpMetaData
headers
object.setHeaders
in interface HttpMetaData
setHeaders
in interface HttpResponseMetaData
headers
- the headers object which contains new values.this
.default StreamingHttpResponse 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 StreamingHttpResponse 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 StreamingHttpResponse 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 StreamingHttpResponse 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
.