public interface StreamingHttpRequest extends HttpRequestMetaData
HttpRequest
but provides the payload as a Publisher
.Modifier and Type | Method and Description |
---|---|
default StreamingHttpRequest |
addCookie(java.lang.CharSequence name,
java.lang.CharSequence value)
|
default StreamingHttpRequest |
addCookie(HttpCookiePair cookie)
Adds a cookie.
|
default StreamingHttpRequest |
addHeader(java.lang.CharSequence name,
java.lang.CharSequence value)
Adds a new header with the specified
name and value . |
default StreamingHttpRequest |
addHeaders(HttpHeaders headers)
Adds all header names and values of
headers object. |
StreamingHttpRequest |
addQueryParameter(java.lang.String key,
java.lang.String value)
Adds a new query parameter with the specified
key and value , which will be
percent-encoded if needed. |
StreamingHttpRequest |
addQueryParameters(java.lang.String key,
java.lang.Iterable<java.lang.String> values)
Adds new query parameters with the specified
key and values . |
StreamingHttpRequest |
addQueryParameters(java.lang.String key,
java.lang.String... values)
Adds new query parameters with the specified
key and values . |
default StreamingHttpRequest |
addSetCookie(java.lang.CharSequence name,
java.lang.CharSequence value)
|
default StreamingHttpRequest |
addSetCookie(HttpSetCookie cookie)
Adds a set-cookie.
|
StreamingHttpRequest |
appendPathSegments(java.lang.String... segments)
Appends segments to the current
HttpRequestMetaData.path() , performing encoding of each segment
(including ('/' ) characters) according
to percent-encoding. |
StreamingHttpRequest |
method(HttpRequestMethod method)
Set the
HttpRequestMethod of this StreamingHttpRequest . |
StreamingHttpRequest |
path(java.lang.String path)
Sets the path, performing encoding according
to percent-encoding, except for forward-slash
(
'/' ) characters. |
Publisher<Buffer> |
payloadBody()
|
default <T> Publisher<T> |
payloadBody(HttpDeserializer<T> deserializer)
Gets and deserializes the payload body.
|
StreamingHttpRequest |
payloadBody(Publisher<Buffer> payloadBody)
Returns a
StreamingHttpRequest with its underlying payload set to payloadBody . |
<T> StreamingHttpRequest |
payloadBody(Publisher<T> payloadBody,
HttpSerializer<T> serializer)
Returns a
StreamingHttpRequest with its underlying payload set to the result of serialization. |
Publisher<java.lang.Object> |
payloadBodyAndTrailers()
|
StreamingHttpRequest |
rawPath(java.lang.String path)
Sets the path to
path , without any encoding performed. |
StreamingHttpRequest |
rawQuery(java.lang.String query)
Sets the query component to
query , without
any encoding performed. |
StreamingHttpRequest |
requestTarget(java.lang.String requestTarget)
Set the request-target.
|
default StreamingHttpRequest |
setHeader(java.lang.CharSequence name,
java.lang.CharSequence value)
Sets a header with the specified
name and value . |
default StreamingHttpRequest |
setHeaders(HttpHeaders headers)
Clears the current header entries and copies all header entries of the specified
headers object. |
StreamingHttpRequest |
setQueryParameter(java.lang.String key,
java.lang.String value)
|
StreamingHttpRequest |
setQueryParameters(java.lang.String key,
java.lang.Iterable<java.lang.String> values)
Sets new query parameters with the specified
key and values . |
StreamingHttpRequest |
setQueryParameters(java.lang.String key,
java.lang.String... values)
Sets new query parameters with the specified
key and values . |
BlockingStreamingHttpRequest |
toBlockingStreamingRequest()
Translate this
StreamingHttpRequest to a BlockingStreamingHttpRequest . |
Single<HttpRequest> |
toRequest()
Translates this
StreamingHttpRequest to a HttpRequest . |
<T> StreamingHttpRequest |
transform(TrailersTransformer<T,Buffer> trailersTransformer)
Returns a
StreamingHttpRequest with its underlying payload transformed to Buffer s,
with access to the trailers. |
<T> StreamingHttpRequest |
transformPayloadBody(java.util.function.Function<Publisher<Buffer>,Publisher<T>> transformer,
HttpSerializer<T> serializer)
Returns a
StreamingHttpRequest with its underlying payload transformed to the result of serialization. |
default <T,R> StreamingHttpRequest |
transformPayloadBody(java.util.function.Function<Publisher<T>,Publisher<R>> transformer,
HttpDeserializer<T> deserializer,
HttpSerializer<R> serializer)
Returns a
StreamingHttpRequest with its underlying payload transformed to the result of serialization. |
StreamingHttpRequest |
transformPayloadBody(java.util.function.UnaryOperator<Publisher<Buffer>> transformer)
Returns a
StreamingHttpRequest with its underlying payload transformed to Buffer s. |
<T> StreamingHttpRequest |
transformRaw(TrailersTransformer<T,java.lang.Object> trailersTransformer)
Returns a
StreamingHttpRequest with its underlying payload transformed to Object s,
with access to the trailers. |
StreamingHttpRequest |
transformRawPayloadBody(java.util.function.UnaryOperator<Publisher<?>> transformer)
Returns a
StreamingHttpRequest with its underlying payload transformed. |
StreamingHttpRequest |
version(HttpProtocolVersion version)
Set the protocol version of this
HttpMetaData . |
effectiveHost, effectivePort, hasQueryParameter, hasQueryParameter, host, method, path, port, queryParameter, queryParameters, queryParameters, queryParametersIterator, queryParametersKeys, queryParametersSize, rawPath, rawQuery, removeQueryParameters, removeQueryParameters, requestTarget, scheme, userInfo
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()
StreamingHttpRequest payloadBody(Publisher<Buffer> payloadBody)
StreamingHttpRequest
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> StreamingHttpRequest payloadBody(Publisher<T> payloadBody, HttpSerializer<T> serializer)
StreamingHttpRequest
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> StreamingHttpRequest transformPayloadBody(java.util.function.Function<Publisher<Buffer>,Publisher<T>> transformer, HttpSerializer<T> serializer)
StreamingHttpRequest
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 requests may be processed.serializer
- Used to serialize the payload body.this
default <T,R> StreamingHttpRequest transformPayloadBody(java.util.function.Function<Publisher<T>,Publisher<R>> transformer, HttpDeserializer<T> deserializer, HttpSerializer<R> serializer)
StreamingHttpRequest
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
StreamingHttpRequest transformPayloadBody(java.util.function.UnaryOperator<Publisher<Buffer>> transformer)
StreamingHttpRequest
with its underlying payload transformed to Buffer
s.StreamingHttpRequest transformRawPayloadBody(java.util.function.UnaryOperator<Publisher<?>> transformer)
StreamingHttpRequest
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> StreamingHttpRequest transform(TrailersTransformer<T,Buffer> trailersTransformer)
StreamingHttpRequest
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> StreamingHttpRequest transformRaw(TrailersTransformer<T,java.lang.Object> trailersTransformer)
StreamingHttpRequest
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<HttpRequest> toRequest()
StreamingHttpRequest
to a HttpRequest
.Single
that completes with a HttpRequest
representation of this
StreamingHttpRequest
.BlockingStreamingHttpRequest toBlockingStreamingRequest()
StreamingHttpRequest
to a BlockingStreamingHttpRequest
.BlockingStreamingHttpRequest
representation of this StreamingHttpRequest
.StreamingHttpRequest rawPath(java.lang.String path)
HttpRequestMetaData
path
, 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)
.
rawPath
in interface HttpRequestMetaData
path
- the encoded path to set.this
.StreamingHttpRequest path(java.lang.String path)
HttpRequestMetaData
'/'
) characters. This allows for path("/abc")
without it turning into
'%2Fabc'
.path
in interface HttpRequestMetaData
path
- the un-encoded path to set.this
.StreamingHttpRequest appendPathSegments(java.lang.String... segments)
HttpRequestMetaData
HttpRequestMetaData.path()
, performing encoding of each segment
(including ('/'
) characters) according
to percent-encoding.
A /
is used to separate each segment and between the current HttpRequestMetaData.path()
and the following segments.appendPathSegments
in interface HttpRequestMetaData
segments
- the un-encoded path to set.this
.StreamingHttpRequest rawQuery(java.lang.String query)
HttpRequestMetaData
query
, 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)
.
rawQuery
in interface HttpRequestMetaData
query
- the encoded query to set.this
.StreamingHttpRequest addQueryParameter(java.lang.String key, java.lang.String value)
HttpRequestMetaData
key
and value
, which will be
percent-encoded if needed.addQueryParameter
in interface HttpRequestMetaData
key
- the query parameter key.value
- the query parameter value.this
.StreamingHttpRequest addQueryParameters(java.lang.String key, java.lang.Iterable<java.lang.String> values)
HttpRequestMetaData
key
and values
. This method is semantically
equivalent to:
for (T value : values) { addQueryParameter(key, value); }
addQueryParameters
in interface HttpRequestMetaData
key
- the query parameter key.values
- the query parameter values.this
.StreamingHttpRequest addQueryParameters(java.lang.String key, java.lang.String... values)
HttpRequestMetaData
key
and values
. This method is semantically
equivalent to:
for (T value : values) { query.addQueryParameter(key, value); }
addQueryParameters
in interface HttpRequestMetaData
key
- the query parameter key.values
- the query parameter values.this
.StreamingHttpRequest setQueryParameter(java.lang.String key, java.lang.String value)
HttpRequestMetaData
key
and value
, which will be
percent-encoded if needed.
Any existing query parameters with the same key are overwritten.setQueryParameter
in interface HttpRequestMetaData
key
- the query parameter key.value
- the query parameter value.this
.StreamingHttpRequest setQueryParameters(java.lang.String key, java.lang.Iterable<java.lang.String> values)
HttpRequestMetaData
key
and values
. This method is equivalent to:
removeQueryParameter(key); for (T value : values) { query.addQueryParameter(key, value); }
setQueryParameters
in interface HttpRequestMetaData
key
- the query parameter key.values
- the query parameter values.this
.StreamingHttpRequest setQueryParameters(java.lang.String key, java.lang.String... values)
HttpRequestMetaData
key
and values
. This method is equivalent to:
removeQueryParameter(key); for (T value : values) { query.addQueryParameter(key, value); }
setQueryParameters
in interface HttpRequestMetaData
key
- the query parameter key.values
- the query parameter values.this
.StreamingHttpRequest version(HttpProtocolVersion version)
HttpMetaData
HttpMetaData
.version
in interface HttpMetaData
version
in interface HttpRequestMetaData
version
- the protocol version to set.this
.StreamingHttpRequest method(HttpRequestMethod method)
HttpRequestMetaData
HttpRequestMethod
of this StreamingHttpRequest
.method
in interface HttpRequestMetaData
method
- the HttpRequestMethod
to set.this
.StreamingHttpRequest requestTarget(java.lang.String requestTarget)
HttpRequestMetaData
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 as HttpRequestMetaData.path()
, HttpRequestMetaData.rawQuery()
, etc.
requestTarget
in interface HttpRequestMetaData
requestTarget
- the percent-encoded
request-target to set.this
.default StreamingHttpRequest addHeader(java.lang.CharSequence name, java.lang.CharSequence value)
HttpMetaData
name
and value
.addHeader
in interface HttpMetaData
addHeader
in interface HttpRequestMetaData
name
- the name of the header.value
- the value of the header.this
.default StreamingHttpRequest addHeaders(HttpHeaders headers)
HttpMetaData
headers
object.addHeaders
in interface HttpMetaData
addHeaders
in interface HttpRequestMetaData
headers
- the headers to add.this
.default StreamingHttpRequest 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 HttpRequestMetaData
name
- the name of the header.value
- the value of the header.this
.default StreamingHttpRequest setHeaders(HttpHeaders headers)
HttpMetaData
headers
object.setHeaders
in interface HttpMetaData
setHeaders
in interface HttpRequestMetaData
headers
- the headers object which contains new values.this
.default StreamingHttpRequest addCookie(HttpCookiePair cookie)
HttpMetaData
This may result in multiple HttpCookiePair
s with same name.
addCookie
in interface HttpMetaData
addCookie
in interface HttpRequestMetaData
cookie
- the cookie to add.this
.default StreamingHttpRequest 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 HttpRequestMetaData
name
- the name of the cookie.value
- the value of the cookie.this
.default StreamingHttpRequest addSetCookie(HttpSetCookie cookie)
HttpMetaData
This may result in multiple HttpSetCookie
s with same name.
addSetCookie
in interface HttpMetaData
addSetCookie
in interface HttpRequestMetaData
cookie
- the cookie to add.this
.default StreamingHttpRequest 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 HttpRequestMetaData
name
- the name of the cookie.value
- the value of the cookie.this
.