Interface StreamingHttpRequest
- All Superinterfaces:
ContextMapHolder
,HttpMetaData
,HttpRequestMetaData
HttpRequest
but provides the payload as a Publisher
.-
Method Summary
Modifier and TypeMethodDescriptiondefault StreamingHttpRequest
addCookie
(HttpCookiePair cookie) Adds a cookie.default StreamingHttpRequest
addCookie
(CharSequence name, CharSequence value) default StreamingHttpRequest
addHeader
(CharSequence name, CharSequence value) Adds a new header with the specifiedname
andvalue
.default StreamingHttpRequest
addHeaders
(HttpHeaders headers) Adds all header names and values ofheaders
object.addQueryParameter
(String key, String value) Adds a new query parameter with the specifiedkey
andvalue
, which will be percent-encoded if needed.addQueryParameters
(String key, Iterable<String> values) Adds new query parameters with the specifiedkey
andvalues
.addQueryParameters
(String key, String... values) Adds new query parameters with the specifiedkey
andvalues
.default StreamingHttpRequest
addSetCookie
(HttpSetCookie cookie) Adds a set-cookie.default StreamingHttpRequest
addSetCookie
(CharSequence name, CharSequence value) appendPathSegments
(String... segments) Appends segments to the currentHttpRequestMetaData.path()
, performing encoding of each segment (including ('/'
) characters) according to percent-encoding.contentEncoding
(BufferEncoder encoder) Set theBufferEncoder
to use for this request.context
(ContextMap context) Sets a context for thisHttpMetaData
.default StreamingHttpRequest
encoding
(ContentCodec encoding) Deprecated.default StreamingHttpRequest
Sets the fragment part of the request target.Get the message-body which contains the payload body concatenated with the trailer (if present).method
(HttpRequestMethod method) Set theHttpRequestMethod
of thisStreamingHttpRequest
.Sets the path, performing encoding according to percent-encoding, except for forward-slash ('/'
) characters.payloadBody
(Publisher<Buffer> payloadBody) Returns aStreamingHttpRequest
with its underlying payload set topayloadBody
.default <T> StreamingHttpRequest
payloadBody
(Publisher<T> payloadBody, HttpSerializer<T> serializer) Deprecated.payloadBody
(Publisher<T> payloadBody, HttpStreamingSerializer<T> serializer) Returns aStreamingHttpRequest
with its underlying payload set to the result of serialization.default <T> Publisher<T>
payloadBody
(HttpDeserializer<T> deserializer) Deprecated.<T> Publisher<T>
payloadBody
(HttpStreamingDeserializer<T> deserializer) Gets and deserializes the payload body.Sets the path, performing encoding according to rfc3986, Query.Sets the path topath
, without any encoding performed.Sets the query component toquery
, without any encoding performed.requestTarget
(String requestTarget) Set the request-target.requestTarget
(String requestTarget, Charset encoding) Set the request-target.default StreamingHttpRequest
setHeader
(CharSequence name, CharSequence value) Sets a header with the specifiedname
andvalue
.default StreamingHttpRequest
setHeaders
(HttpHeaders headers) Clears the current header entries and copies all header entries of the specifiedheaders
object.setQueryParameter
(String key, String value) setQueryParameters
(String key, Iterable<String> values) Sets new query parameters with the specifiedkey
andvalues
.setQueryParameters
(String key, String... values) Sets new query parameters with the specifiedkey
andvalues
.Translate thisStreamingHttpRequest
to aBlockingStreamingHttpRequest
.Translates thisStreamingHttpRequest
to aHttpRequest
.transform
(TrailersTransformer<T, Buffer> trailersTransformer) Returns aStreamingHttpRequest
with its underlying payload transformed toBuffer
s, with access to the trailers.<T,
S> StreamingHttpRequest transform
(TrailersTransformer<T, S> trailersTransformer, HttpStreamingDeserializer<S> deserializer) Returns aStreamingHttpResponse
with its underlying payload transformed toStreamingHttpRequest
s, with access to the trailers.transformMessageBody
(UnaryOperator<Publisher<?>> transformer) Transform the message-body which contains the payload body concatenated with the trailer (if present).default <T> StreamingHttpRequest
transformPayloadBody
(Function<Publisher<Buffer>, Publisher<T>> transformer, HttpSerializer<T> serializer) Deprecated.transformPayloadBody
(Function<Publisher<Buffer>, Publisher<T>> transformer, HttpStreamingSerializer<T> serializer) Returns aStreamingHttpRequest
with its underlying payload transformed to the result of serialization.default <T,
R> StreamingHttpRequest transformPayloadBody
(Function<Publisher<T>, Publisher<R>> transformer, HttpDeserializer<T> deserializer, HttpSerializer<R> serializer) <T,
R> StreamingHttpRequest transformPayloadBody
(Function<Publisher<T>, Publisher<R>> transformer, HttpStreamingDeserializer<T> deserializer, HttpStreamingSerializer<R> serializer) Returns aStreamingHttpRequest
with its underlying payload transformed to the result of serialization.transformPayloadBody
(UnaryOperator<Publisher<Buffer>> transformer) Returns aStreamingHttpRequest
with its underlying payload transformed toBuffer
s.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.HttpRequestMetaData
contentEncoding, effectiveHostAndPort, fragment, hasQueryParameter, hasQueryParameter, host, method, path, port, query, queryParameter, queryParameters, queryParameters, queryParametersIterator, queryParametersKeys, queryParametersSize, rawPath, rawQuery, removeQueryParameters, removeQueryParameters, requestTarget, requestTarget, scheme, userInfo
-
Method Details
-
payloadBody
-
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 underlyingPublisher
.- 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 underlyingPublisher
.- Returns:
- The results of the deserialization operation.
-
messageBody
Get the message-body which contains the payload body concatenated with the trailer (if present).- Returns:
- a
Publisher
that represents the message-body which contains the payload body concatenated with the trailer (if present).
-
payloadBody
Returns aStreamingHttpRequest
with its underlying payload set topayloadBody
.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 usetransformPayloadBody(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 existingPublisher
payload body.- Parameters:
payloadBody
- The new payload body.- Returns:
this
-
payloadBody
@Deprecated default <T> StreamingHttpRequest payloadBody(Publisher<T> payloadBody, HttpSerializer<T> serializer) Deprecated.Returns aStreamingHttpRequest
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 usetransformPayloadBody(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 existingPublisher
payload body.- 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> StreamingHttpRequest payloadBody(Publisher<T> payloadBody, HttpStreamingSerializer<T> serializer) Returns aStreamingHttpRequest
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 usetransformPayloadBody(Function, HttpStreamingSerializer)
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 existingPublisher
payload body.- 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
-
transformPayloadBody
@Deprecated default <T> StreamingHttpRequest transformPayloadBody(Function<Publisher<Buffer>, Publisher<T>> transformer, HttpSerializer<T> serializer) Deprecated.Returns aStreamingHttpRequest
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 bodyPublisher
and returns the new payload bodyPublisher
prior to serialization. It is assumed the existing payload bodyPublisher
will be transformed/consumed or else no more requests may be processed.serializer
- Used to serialize the payload body.- Returns:
this
-
transformPayloadBody
<T> StreamingHttpRequest transformPayloadBody(Function<Publisher<Buffer>, Publisher<T>> transformer, HttpStreamingSerializer<T> serializer) Returns aStreamingHttpRequest
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 bodyPublisher
and returns the new payload bodyPublisher
prior to serialization. It is assumed the existing payload bodyPublisher
will be transformed/consumed or else no more requests may be processed.serializer
- Used to serialize the payload body.- Returns:
this
-
transformPayloadBody
@Deprecated default <T,R> StreamingHttpRequest transformPayloadBody(Function<Publisher<T>, Publisher<R>> transformer, HttpDeserializer<T> deserializer, HttpSerializer<R> serializer) Returns aStreamingHttpRequest
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 bodyPublisher
and returns the new payload bodyPublisher
prior to serialization. It is assumed the existing payload bodyPublisher
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
<T,R> StreamingHttpRequest transformPayloadBody(Function<Publisher<T>, Publisher<R>> transformer, HttpStreamingDeserializer<T> deserializer, HttpStreamingSerializer<R> serializer) Returns aStreamingHttpRequest
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 bodyPublisher
and returns the new payload bodyPublisher
prior to serialization. It is assumed the existing payload bodyPublisher
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
Returns aStreamingHttpRequest
with its underlying payload transformed toBuffer
s.- Parameters:
transformer
- AUnaryOperator
which take as a parameter the existing payload bodyPublisher
and returns the new payload bodyPublisher
. It is assumed the existing payload bodyPublisher
will be transformed/consumed or else no more requests may be processed.- Returns:
this
-
transformMessageBody
Transform the message-body which contains the payload body concatenated with the trailer (if present).The transformation is not expected to change the content of the message body
Publisher
or presence of trailers in it. For example, behavior is undefined if a content is altered (added/removed/resized) ortrailers
are inserted to or removed from to the returnedPublisher
. To alter the payload body content usetransformPayloadBody(UnaryOperator)
method, its overloads, ortransform(TrailersTransformer)
method which can also be used to modify trailers.- Parameters:
transformer
- Responsible for transforming the message-body.- Returns:
this
.
-
transform
Returns aStreamingHttpRequest
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
-
transform
<T,S> StreamingHttpRequest transform(TrailersTransformer<T, S> trailersTransformer, HttpStreamingDeserializer<S> deserializer) Returns aStreamingHttpResponse
with its underlying payload transformed toStreamingHttpRequest
s, with access to the trailers.- Type Parameters:
T
- The type of state used during the transformation.S
- The type of objects to deserialize.- Parameters:
trailersTransformer
-TrailersTransformer
to use for this transform.deserializer
- Used to deserialize the existing payload body.- Returns:
this
-
toRequest
Single<HttpRequest> toRequest()Translates thisStreamingHttpRequest
to aHttpRequest
.- Returns:
- a
Single
that completes with aHttpRequest
representation of thisStreamingHttpRequest
.
-
toBlockingStreamingRequest
BlockingStreamingHttpRequest toBlockingStreamingRequest()Translate thisStreamingHttpRequest
to aBlockingStreamingHttpRequest
.- Returns:
- a
BlockingStreamingHttpRequest
representation of thisStreamingHttpRequest
.
-
rawPath
Description copied from interface:HttpRequestMetaData
Sets the path topath
, without any encoding performed. This assumes that any characters that require encoding have been encoded according to percent-encoding by the caller.Because this modifies the request target, this may result in the clearing of internal caches. See
HttpRequestMetaData.requestTarget(String)
.- Specified by:
rawPath
in interfaceHttpRequestMetaData
- Parameters:
path
- the encoded path to set.- Returns:
this
.
-
path
Description copied from interface:HttpRequestMetaData
Sets the path, performing encoding according to percent-encoding, except for forward-slash ('/'
) characters. This allows forpath("/abc")
without it turning into'%2Fabc'
.- Specified by:
path
in interfaceHttpRequestMetaData
- Parameters:
path
- the un-encoded path to set.- Returns:
this
.
-
appendPathSegments
Description copied from interface:HttpRequestMetaData
Appends segments to the currentHttpRequestMetaData.path()
, performing encoding of each segment (including ('/'
) characters) according to percent-encoding. A/
is used to separate each segment and between the currentHttpRequestMetaData.path()
and the following segments.- Specified by:
appendPathSegments
in interfaceHttpRequestMetaData
- Parameters:
segments
- the un-encoded path to set.- Returns:
this
.
-
rawQuery
Description copied from interface:HttpRequestMetaData
Sets the query component toquery
, without any encoding performed. This assumes that any characters that require encoding have been encoded according to percent-encoding by the caller.Because this modifies the request target, this may result in the clearing of internal caches. See
HttpRequestMetaData.requestTarget(String)
.- Specified by:
rawQuery
in interfaceHttpRequestMetaData
- Parameters:
query
- the encoded query to set.null
will clear the query value (e.g. no?
present inHttpRequestMetaData.requestTarget()
.- Returns:
this
.
-
query
Description copied from interface:HttpRequestMetaData
Sets the path, performing encoding according to rfc3986, Query.- Specified by:
query
in interfaceHttpRequestMetaData
- Parameters:
query
- the un-encoded query to set.null
will clear the query value (e.g. no?
present inHttpRequestMetaData.requestTarget()
.- Returns:
this
.
-
addQueryParameter
Description copied from interface:HttpRequestMetaData
Adds a new query parameter with the specifiedkey
andvalue
, which will be percent-encoded if needed.- Specified by:
addQueryParameter
in interfaceHttpRequestMetaData
- Parameters:
key
- the query parameter key.value
- the query parameter value.- Returns:
this
.
-
addQueryParameters
Description copied from interface:HttpRequestMetaData
Adds new query parameters with the specifiedkey
andvalues
. This method is semantically equivalent to:for (T value : values) { addQueryParameter(key, value); }
- Specified by:
addQueryParameters
in interfaceHttpRequestMetaData
- Parameters:
key
- the query parameter key.values
- the query parameter values.- Returns:
this
.
-
addQueryParameters
Description copied from interface:HttpRequestMetaData
Adds new query parameters with the specifiedkey
andvalues
. This method is semantically equivalent to:for (T value : values) { query.addQueryParameter(key, value); }
- Specified by:
addQueryParameters
in interfaceHttpRequestMetaData
- Parameters:
key
- the query parameter key.values
- the query parameter values.- Returns:
this
.
-
setQueryParameter
Description copied from interface:HttpRequestMetaData
Sets a query parameter with the specifiedkey
andvalue
, which will be percent-encoded if needed. Any existing query parameters with the same key are overwritten.- Specified by:
setQueryParameter
in interfaceHttpRequestMetaData
- Parameters:
key
- the query parameter key.value
- the query parameter value.- Returns:
this
.
-
setQueryParameters
Description copied from interface:HttpRequestMetaData
Sets new query parameters with the specifiedkey
andvalues
. This method is equivalent to:removeQueryParameter(key); for (T value : values) { query.addQueryParameter(key, value); }
- Specified by:
setQueryParameters
in interfaceHttpRequestMetaData
- Parameters:
key
- the query parameter key.values
- the query parameter values.- Returns:
this
.
-
setQueryParameters
Description copied from interface:HttpRequestMetaData
Sets new query parameters with the specifiedkey
andvalues
. This method is equivalent to:removeQueryParameter(key); for (T value : values) { query.addQueryParameter(key, value); }
- Specified by:
setQueryParameters
in interfaceHttpRequestMetaData
- Parameters:
key
- the query parameter key.values
- the query parameter values.- Returns:
this
.
-
version
Description copied from interface:HttpMetaData
Set the protocol version of thisHttpMetaData
.- Specified by:
version
in interfaceHttpMetaData
- Specified by:
version
in interfaceHttpRequestMetaData
- Parameters:
version
- the protocol version to set.- Returns:
this
.
-
method
Description copied from interface:HttpRequestMetaData
Set theHttpRequestMethod
of thisStreamingHttpRequest
.- Specified by:
method
in interfaceHttpRequestMetaData
- Parameters:
method
- theHttpRequestMethod
to set.- Returns:
this
.
-
fragment
Description copied from interface:HttpRequestMetaData
Sets the fragment part of the request target.- Specified by:
fragment
in interfaceHttpRequestMetaData
- Parameters:
fragment
- the fragment 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:
-
contentEncoding
Description copied from interface:HttpRequestMetaData
Set theBufferEncoder
to use for this request. The value can be used by filters (such asContentEncodingHttpRequesterFilter
) to applyHttpHeaderNames.CONTENT_ENCODING
to the request.- Specified by:
contentEncoding
in interfaceHttpRequestMetaData
- Parameters:
encoder
-BufferEncoder
to use for this request.- Returns:
this
.
-
requestTarget
Description copied from interface:HttpRequestMetaData
Set the request-target.This will be treated as encoded according to percent-encoding.
This may result in clearing of internal caches used by methods that are derived from the
request-target
, such asHttpRequestMetaData.path()
,HttpRequestMetaData.rawQuery()
, etc.- Specified by:
requestTarget
in interfaceHttpRequestMetaData
- Parameters:
requestTarget
- the percent-encoded request-target to set.- Returns:
this
.
-
requestTarget
Description copied from interface:HttpRequestMetaData
Set the request-target.This may result in clearing of internal caches used by methods that are derived from the
request-target
, such asHttpRequestMetaData.path()
,HttpRequestMetaData.rawQuery()
, etc.- Specified by:
requestTarget
in interfaceHttpRequestMetaData
- Parameters:
requestTarget
- the request-target to set.encoding
- theCharset
to use to encoderequestTarget
before setting the value.- Returns:
this
.
-
addHeader
Description copied from interface:HttpMetaData
Adds a new header with the specifiedname
andvalue
.- Specified by:
addHeader
in interfaceHttpMetaData
- Specified by:
addHeader
in interfaceHttpRequestMetaData
- 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 interfaceHttpRequestMetaData
- 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 interfaceHttpRequestMetaData
- 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 interfaceHttpRequestMetaData
- 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 interfaceHttpRequestMetaData
- 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 interfaceHttpRequestMetaData
- 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 interfaceHttpRequestMetaData
- 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 interfaceHttpRequestMetaData
- 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 interfaceHttpRequestMetaData
- Parameters:
context
- the new context for thisHttpMetaData
.- Returns:
this
.
-
payloadBody(Publisher, HttpStreamingSerializer)
.