Interface BlockingStreamingHttpResponse
- All Superinterfaces:
ContextMapHolder
,HttpMetaData
,HttpResponseMetaData
HttpResponse
but provides the payload as a BlockingIterable
.-
Method Summary
Modifier and TypeMethodDescriptiondefault BlockingStreamingHttpResponse
addCookie
(HttpCookiePair cookie) Adds a cookie.default BlockingStreamingHttpResponse
addCookie
(CharSequence name, CharSequence value) default BlockingStreamingHttpResponse
addHeader
(CharSequence name, CharSequence value) Adds a new header with the specifiedname
andvalue
.default BlockingStreamingHttpResponse
addHeaders
(HttpHeaders headers) Adds all header names and values ofheaders
object.default BlockingStreamingHttpResponse
addSetCookie
(HttpSetCookie cookie) Adds a set-cookie.default BlockingStreamingHttpResponse
addSetCookie
(CharSequence name, CharSequence value) context
(ContextMap context) Sets a context for thisHttpMetaData
.default BlockingStreamingHttpResponse
encoding
(ContentCodec encoding) Deprecated.Get theHttpMessageBodyIterable
for this response.messageBody
(HttpMessageBodyIterable<Buffer> messageBody) Set theHttpMessageBodyIterable
for this response.messageBody
(HttpMessageBodyIterable<T> messageBody, HttpStreamingSerializer<T> serializer) Set theHttpMessageBodyIterable
for this response.<T> HttpMessageBodyIterable<T>
messageBody
(HttpStreamingDeserializer<T> deserializer) Get theHttpMessageBodyIterable
for this response and deserialize to typeBlockingStreamingHttpResponse
.default <T> BlockingIterable<T>
payloadBody
(HttpDeserializer<T> deserializer) Deprecated.<T> BlockingIterable<T>
payloadBody
(HttpStreamingDeserializer<T> deserializer) Gets and deserializes the payload body.payloadBody
(InputStream payloadBody) Returns aBlockingStreamingHttpResponse
with its underlying payload set topayloadBody
.payloadBody
(Iterable<Buffer> payloadBody) Returns aBlockingStreamingHttpResponse
with its underlying payload set topayloadBody
.default <T> BlockingStreamingHttpResponse
payloadBody
(Iterable<T> payloadBody, HttpSerializer<T> serializer) Deprecated.payloadBody
(Iterable<T> payloadBody, HttpStreamingSerializer<T> serializer) Returns aBlockingStreamingHttpResponse
with its underlying payload set to the result of serialization.default InputStream
Gets the underlying payload as anInputStream
.default BlockingStreamingHttpResponse
setHeader
(CharSequence name, CharSequence value) Sets a header with the specifiedname
andvalue
.default BlockingStreamingHttpResponse
setHeaders
(HttpHeaders headers) Clears the current header entries and copies all header entries of the specifiedheaders
object.status
(HttpResponseStatus status) Set the status of thisStreamingHttpResponse
.Translates thisBlockingStreamingHttpResponse
to aHttpResponse
.Translates thisBlockingStreamingHttpResponse
to aStreamingHttpResponse
.default <T> BlockingStreamingHttpResponse
transform
(TrailersTransformer<T, Buffer> trailersTransformer) Deprecated.default <T> BlockingStreamingHttpResponse
transformPayloadBody
(Function<BlockingIterable<Buffer>, BlockingIterable<T>> transformer, HttpSerializer<T> serializer) Deprecated.default <T,
R> BlockingStreamingHttpResponse transformPayloadBody
(Function<BlockingIterable<T>, BlockingIterable<R>> transformer, HttpDeserializer<T> deserializer, HttpSerializer<R> serializer) Deprecated.default BlockingStreamingHttpResponse
transformPayloadBody
(UnaryOperator<BlockingIterable<Buffer>> transformer) Deprecated.UsepayloadBody()
andpayloadBody(Iterable)
.version
(HttpProtocolVersion version) Set the protocol version of thisHttpMetaData
.Methods inherited from interface io.servicetalk.http.api.HttpMetaData
context, encoding, headers, toString, toString, version
Methods inherited from interface io.servicetalk.http.api.HttpResponseMetaData
status
-
Method Details
-
payloadBody
BlockingIterable<Buffer> payloadBody() -
payloadBodyInputStream
Gets the underlying payload as anInputStream
.- Returns:
- The
InputStream
representation of the underlying payload body.
-
payloadBody
Deprecated.Gets and deserializes the payload body.- Type Parameters:
T
- The resulting type of the deserialization operation.- Parameters:
deserializer
- The function that deserializes the underlyingBlockingIterable
.- Returns:
- The results of the deserialization operation.
-
payloadBody
Gets and deserializes the payload body.- Type Parameters:
T
- The resulting type of the deserialization operation.- Parameters:
deserializer
- The function that deserializes the underlyingBlockingIterable
.- Returns:
- The results of the deserialization operation.
-
messageBody
HttpMessageBodyIterable<Buffer> messageBody()Get theHttpMessageBodyIterable
for this response.- Returns:
- the
HttpMessageBodyIterable
for this response.
-
messageBody
Get theHttpMessageBodyIterable
for this response and deserialize to typeBlockingStreamingHttpResponse
.- Type Parameters:
T
- The resulting type of the deserialization operation.- Parameters:
deserializer
- The function that deserializes the underlyingBlockingIterable
.- Returns:
- the
HttpMessageBodyIterable
for this payloadBody.
-
payloadBody
Returns aBlockingStreamingHttpResponse
with its underlying payload set topayloadBody
.A best effort will be made to apply back pressure to the existing payload body which is being replaced. 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 payload body that is being replaced.- Parameters:
payloadBody
- The new payload body.- Returns:
this
-
payloadBody
Returns aBlockingStreamingHttpResponse
with its underlying payload set topayloadBody
.A best effort will be made to apply back pressure to the existing payload body which is being replaced. 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 payload body that is being replaced.- Parameters:
payloadBody
- The new payload body.- Returns:
this
-
messageBody
Set theHttpMessageBodyIterable
for this response.- Parameters:
messageBody
- The new message body.- Returns:
this
.
-
payloadBody
@Deprecated default <T> BlockingStreamingHttpResponse payloadBody(Iterable<T> payloadBody, HttpSerializer<T> serializer) Deprecated.Returns aBlockingStreamingHttpResponse
with its underlying payload set to the result of serialization.A best effort will be made to apply back pressure to the existing payload body which is being replaced. 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 payload body that is being replaced.- Type Parameters:
T
- The type of objects to serialize.- Parameters:
payloadBody
- The new payload body, prior to serialization.serializer
- Used to serialize the payload body.- Returns:
this
-
payloadBody
<T> BlockingStreamingHttpResponse payloadBody(Iterable<T> payloadBody, HttpStreamingSerializer<T> serializer) Returns aBlockingStreamingHttpResponse
with its underlying payload set to the result of serialization.A best effort will be made to apply back pressure to the existing payload body which is being replaced. If this default policy is not sufficient
payloadBody()
can be used to drain with 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 payload body that is being replaced.- Type Parameters:
T
- The type of objects to serialize.- Parameters:
payloadBody
- The new payload body, prior to serialization.serializer
- Used to serialize the payload body.- Returns:
this
-
messageBody
<T> BlockingStreamingHttpResponse messageBody(HttpMessageBodyIterable<T> messageBody, HttpStreamingSerializer<T> serializer) Set theHttpMessageBodyIterable
for this response.- Type Parameters:
T
- The type of the serialized objects.- Parameters:
messageBody
- The serialized message body.serializer
- The function that serializes the underlyingBlockingIterable
.- Returns:
this
-
transformPayloadBody
@Deprecated default <T> BlockingStreamingHttpResponse transformPayloadBody(Function<BlockingIterable<Buffer>, BlockingIterable<T>> transformer, HttpSerializer<T> serializer) Deprecated.Returns aBlockingStreamingHttpResponse
with its underlying payload transformed to the result of serialization.- Type Parameters:
T
- The type of objects to serialize.- Parameters:
transformer
- AFunction
which take as a parameter the existing payload bodyBlockingIterable
and returns the new payload bodyBlockingIterable
prior to serialization. It is assumed the existing payload bodyBlockingIterable
will be transformed/consumed or else no more responses may be processed.serializer
- Used to serialize the payload body.- Returns:
this
-
transformPayloadBody
@Deprecated default <T,R> BlockingStreamingHttpResponse transformPayloadBody(Function<BlockingIterable<T>, BlockingIterable<R>> transformer, HttpDeserializer<T> deserializer, HttpSerializer<R> serializer) Deprecated.Returns aBlockingStreamingHttpResponse
with its underlying payload transformed to the result of serialization.- Type Parameters:
T
- The type of objects to deserialize.R
- The type of objects to serialize.- Parameters:
transformer
- AFunction
which take as a parameter the existing payload bodyBlockingIterable
and returns the new payload bodyBlockingIterable
prior to serialization. It is assumed the existing payload bodyBlockingIterable
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.- Returns:
this
-
transformPayloadBody
@Deprecated default BlockingStreamingHttpResponse transformPayloadBody(UnaryOperator<BlockingIterable<Buffer>> transformer) Deprecated.UsepayloadBody()
andpayloadBody(Iterable)
.Returns aBlockingStreamingHttpResponse
with its underlying payload transformed toBuffer
s.- Parameters:
transformer
- AFunction
which take as a parameter the existing payload bodyBlockingIterable
and returns the new payload bodyBlockingIterable
. It is assumed the existing payload bodyBlockingIterable
will be transformed/consumed or else no more responses may be processed.- Returns:
this
-
transform
@Deprecated default <T> BlockingStreamingHttpResponse transform(TrailersTransformer<T, Buffer> trailersTransformer) Deprecated.Returns aBlockingStreamingHttpResponse
with its underlying payload transformed toBuffer
s, with access to the trailers.- Type Parameters:
T
- The type of state used during the transformation.- Parameters:
trailersTransformer
-TrailersTransformer
to use for this transform.- Returns:
this
-
toResponse
Single<HttpResponse> toResponse()Translates thisBlockingStreamingHttpResponse
to aHttpResponse
.- Returns:
- a
Single
that completes with aHttpResponse
representation of thisBlockingStreamingHttpResponse
.
-
toStreamingResponse
StreamingHttpResponse toStreamingResponse()Translates thisBlockingStreamingHttpResponse
to aStreamingHttpResponse
.- Returns:
- a
StreamingHttpResponse
representation of thisBlockingStreamingHttpResponse
.
-
version
Description copied from interface:HttpMetaData
Set the protocol version of thisHttpMetaData
.- Specified by:
version
in interfaceHttpMetaData
- Specified by:
version
in interfaceHttpResponseMetaData
- Parameters:
version
- the protocol version to set.- Returns:
this
.
-
status
Description copied from interface:HttpResponseMetaData
Set the status of thisStreamingHttpResponse
.- Specified by:
status
in interfaceHttpResponseMetaData
- Parameters:
status
- TheHttpResponseStatus
to set.- Returns:
this
.
-
encoding
Deprecated.Description copied from interface:HttpMetaData
TheContentCodec
used to encode the payload of a request or a response. If the endpoint is setup withContentCodingHttpServiceFilter
, 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 passingIdentity.identity()
.- Specified by:
encoding
in interfaceHttpMetaData
- Parameters:
encoding
- TheContentCodec
used for the encoding of the payload.- Returns:
this
.- See Also:
-
addHeader
Description copied from interface:HttpMetaData
Adds a new header with the specifiedname
andvalue
.- Specified by:
addHeader
in interfaceHttpMetaData
- Specified by:
addHeader
in interfaceHttpResponseMetaData
- Parameters:
name
- the name of the header.value
- the value of the header.- Returns:
this
.
-
addHeaders
Description copied from interface:HttpMetaData
Adds all header names and values ofheaders
object.- Specified by:
addHeaders
in interfaceHttpMetaData
- Specified by:
addHeaders
in interfaceHttpResponseMetaData
- Parameters:
headers
- the headers to add.- Returns:
this
.
-
setHeader
Description copied from interface:HttpMetaData
Sets a header with the specifiedname
andvalue
. Any existing headers with the same name are overwritten.- Specified by:
setHeader
in interfaceHttpMetaData
- Specified by:
setHeader
in interfaceHttpResponseMetaData
- Parameters:
name
- the name of the header.value
- the value of the header.- Returns:
this
.
-
setHeaders
Description copied from interface:HttpMetaData
Clears the current header entries and copies all header entries of the specifiedheaders
object.- Specified by:
setHeaders
in interfaceHttpMetaData
- Specified by:
setHeaders
in interfaceHttpResponseMetaData
- Parameters:
headers
- the headers object which contains new values.- Returns:
this
.
-
addCookie
Description copied from interface:HttpMetaData
Adds a cookie.This may result in multiple
HttpCookiePair
s with same name.- Specified by:
addCookie
in interfaceHttpMetaData
- Specified by:
addCookie
in interfaceHttpResponseMetaData
- Parameters:
cookie
- the cookie to add.- Returns:
this
.
-
addCookie
Description copied from interface:HttpMetaData
Adds a cookie with the specifiedname
andvalue
.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.- Specified by:
addCookie
in interfaceHttpMetaData
- Specified by:
addCookie
in interfaceHttpResponseMetaData
- Parameters:
name
- the name of the cookie.value
- the value of the cookie.- Returns:
this
.
-
addSetCookie
Description copied from interface:HttpMetaData
Adds a set-cookie.This may result in multiple
HttpSetCookie
s with same name.- Specified by:
addSetCookie
in interfaceHttpMetaData
- Specified by:
addSetCookie
in interfaceHttpResponseMetaData
- Parameters:
cookie
- the cookie to add.- Returns:
this
.
-
addSetCookie
Description copied from interface:HttpMetaData
Adds a set-cookie with the specifiedname
andvalue
.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.- Specified by:
addSetCookie
in interfaceHttpMetaData
- Specified by:
addSetCookie
in interfaceHttpResponseMetaData
- Parameters:
name
- the name of the cookie.value
- the value of the cookie.- Returns:
this
.
-
context
Description copied from interface:HttpMetaData
Sets a context for thisHttpMetaData
.Context can be used to associate a state with a request or response message without serializing its state on the wire.
- Specified by:
context
in interfaceContextMapHolder
- Specified by:
context
in interfaceHttpMetaData
- Specified by:
context
in interfaceHttpResponseMetaData
- Parameters:
context
- the new context for thisHttpMetaData
.- Returns:
this
.
-
payloadBody(HttpStreamingDeserializer)
.