public interface StreamingHttpResponse extends HttpResponseMetaData
HttpResponse but provides the payload as a Publisher.| Modifier and Type | Method and Description |
|---|---|
default StreamingHttpResponse |
addCookie(CharSequence name,
CharSequence value)
|
default StreamingHttpResponse |
addCookie(HttpCookiePair cookie)
Adds a cookie.
|
default StreamingHttpResponse |
addHeader(CharSequence name,
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(CharSequence name,
CharSequence value)
|
default StreamingHttpResponse |
addSetCookie(HttpSetCookie cookie)
Adds a set-cookie.
|
StreamingHttpResponse |
encoding(ContentCodec encoding)
The
ContentCodec used to encode the payload of a request or a response. |
Publisher<Buffer> |
payloadBody()
Gets the underlying payload as a
Publisher of Buffers. |
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<Object> |
payloadBodyAndTrailers()
Gets a
Publisher that combines the raw payload body concatenated with the trailers. |
default StreamingHttpResponse |
setHeader(CharSequence name,
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 Buffers,
with access to the trailers. |
<T> StreamingHttpResponse |
transformPayloadBody(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(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(UnaryOperator<Publisher<Buffer>> transformer)
Returns a
StreamingHttpResponse with its underlying payload transformed to Buffers. |
<T> StreamingHttpResponse |
transformRaw(TrailersTransformer<T,Object> trailersTransformer)
Returns a
StreamingHttpResponse with its underlying payload transformed to Objects,
with access to the trailers. |
StreamingHttpResponse |
transformRawPayloadBody(UnaryOperator<Publisher<?>> transformer)
Returns a
StreamingHttpResponse with its underlying payload transformed. |
StreamingHttpResponse |
version(HttpProtocolVersion version)
Set the protocol version of this
HttpMetaData. |
status, statusPublisher<Buffer> payloadBody()
Publisher of Buffers.Publisher of Buffer representation of the underlyingdefault <T> Publisher<T> payloadBody(HttpDeserializer<T> deserializer)
T - The resulting type of the deserialization operation.deserializer - The function that deserializes the underlying Publisher.Publisher<Object> payloadBodyAndTrailers()
Publisher that combines the raw payload body concatenated with the trailers.Publisher that combines the raw payload body concatenated with the
trailers.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(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.thisdefault <T,R> StreamingHttpResponse transformPayloadBody(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.thisStreamingHttpResponse transformPayloadBody(UnaryOperator<Publisher<Buffer>> transformer)
StreamingHttpResponse with its underlying payload transformed to Buffers.transformer - A Function which take as a parameter the existing payload body Publisher and
returns the new payload body Publisher. It is assumed the existing payload body Publisher will be
transformed/consumed or else no more responses may be processed.thisStreamingHttpResponse transformRawPayloadBody(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 Buffers,
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,Object> trailersTransformer)
StreamingHttpResponse with its underlying payload transformed to Objects,
with access to the trailers.T - The type of state used during the transformation.trailersTransformer - TrailersTransformer to use for this transform.thisSingle<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)
HttpMetaDataHttpMetaData.version in interface HttpMetaDataversion in interface HttpResponseMetaDataversion - the protocol version to set.this.StreamingHttpResponse encoding(ContentCodec encoding)
HttpMetaDataContentCodec used to encode the payload of a request or a response.
If the endpoint is setup with ContentCodingHttpServiceFilter, the server will
auto-establish the accepted encoding for the response, unless the caller provides a specific encoding
by calling this method.
Any encoding passed here, takes precedence. In other words, a compressed response, can
be disabled by passing ContentCodings.identity().encoding in interface HttpMetaDataencoding - The ContentCodec used for the encoding of the payload.this.default StreamingHttpResponse addHeader(CharSequence name, CharSequence value)
HttpMetaDataname and value.addHeader in interface HttpMetaDataaddHeader in interface HttpResponseMetaDataname - the name of the header.value - the value of the header.this.default StreamingHttpResponse addHeaders(HttpHeaders headers)
HttpMetaDataheaders object.addHeaders in interface HttpMetaDataaddHeaders in interface HttpResponseMetaDataheaders - the headers to add.this.default StreamingHttpResponse setHeader(CharSequence name, CharSequence value)
HttpMetaDataname and value. Any existing headers with the same name are
overwritten.setHeader in interface HttpMetaDatasetHeader in interface HttpResponseMetaDataname - the name of the header.value - the value of the header.this.default StreamingHttpResponse setHeaders(HttpHeaders headers)
HttpMetaDataheaders object.setHeaders in interface HttpMetaDatasetHeaders in interface HttpResponseMetaDataheaders - the headers object which contains new values.this.default StreamingHttpResponse addCookie(HttpCookiePair cookie)
HttpMetaData
This may result in multiple HttpCookiePairs with same name.
addCookie in interface HttpMetaDataaddCookie in interface HttpResponseMetaDatacookie - the cookie to add.this.default StreamingHttpResponse addCookie(CharSequence name, CharSequence value)
HttpMetaDataname and
value.
This may result in multiple HttpSetCookies 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 HttpMetaDataaddCookie in interface HttpResponseMetaDataname - the name of the cookie.value - the value of the cookie.this.default StreamingHttpResponse addSetCookie(HttpSetCookie cookie)
HttpMetaData
This may result in multiple HttpSetCookies with same name.
addSetCookie in interface HttpMetaDataaddSetCookie in interface HttpResponseMetaDatacookie - the cookie to add.this.default StreamingHttpResponse addSetCookie(CharSequence name, CharSequence value)
HttpMetaDataname
and value.
This may result in multiple HttpSetCookies 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 HttpMetaDataaddSetCookie in interface HttpResponseMetaDataname - the name of the cookie.value - the value of the cookie.this.