public interface HttpRequest extends HttpRequestMetaData
Object.| Modifier and Type | Method and Description |
|---|---|
default HttpRequest |
addCookie(CharSequence name,
CharSequence value)
|
default HttpRequest |
addCookie(HttpCookiePair cookie)
Adds a cookie.
|
default HttpRequest |
addHeader(CharSequence name,
CharSequence value)
Adds a new header with the specified
name and value. |
default HttpRequest |
addHeaders(HttpHeaders headers)
Adds all header names and values of
headers object. |
HttpRequest |
addQueryParameter(String key,
String value)
Adds a new query parameter with the specified
key and value, which will be
percent-encoded if needed. |
HttpRequest |
addQueryParameters(String key,
Iterable<String> values)
Adds new query parameters with the specified
key and values. |
HttpRequest |
addQueryParameters(String key,
String... values)
Adds new query parameters with the specified
key and values. |
default HttpRequest |
addSetCookie(CharSequence name,
CharSequence value)
|
default HttpRequest |
addSetCookie(HttpSetCookie cookie)
Adds a set-cookie.
|
default HttpRequest |
addTrailer(CharSequence name,
CharSequence value)
Adds a new trailer with the specified
name and value. |
default HttpRequest |
addTrailers(HttpHeaders trailers)
Adds all trailer names and values of
trailer object. |
HttpRequest |
appendPathSegments(String... segments)
Appends segments to the current
HttpRequestMetaData.path(), performing encoding of each segment
(including ('/') characters) according
to percent-encoding. |
HttpRequest |
contentEncoding(BufferEncoder encoder)
Set the
BufferEncoder to use for this request. |
HttpRequest |
context(ContextMap context)
Sets a context for this
HttpMetaData. |
HttpRequest |
encoding(ContentCodec encoding)
Deprecated.
|
HttpRequest |
method(HttpRequestMethod method)
Set the
HttpRequestMethod of this StreamingHttpRequest. |
HttpRequest |
path(String path)
Sets the path, performing encoding according
to percent-encoding, except for forward-slash
(
'/') characters. |
Buffer |
payloadBody()
Gets the underlying payload as a
Buffer. |
HttpRequest |
payloadBody(Buffer payloadBody)
Returns an
HttpRequest with its underlying payload set to payloadBody. |
default <T> T |
payloadBody(HttpDeserializer<T> deserializer)
Deprecated.
|
<T> T |
payloadBody(HttpDeserializer2<T> deserializer)
Gets and deserializes the payload body.
|
<T> HttpRequest |
payloadBody(T pojo,
HttpSerializer<T> serializer)
Deprecated.
|
<T> HttpRequest |
payloadBody(T pojo,
HttpSerializer2<T> serializer)
Returns an
HttpRequest with its underlying payload set to the results of serialization of pojo. |
HttpRequest |
query(String query)
Sets the path, performing encoding according
to rfc3986, Query.
|
HttpRequest |
rawPath(String path)
Sets the path to
path, without any encoding performed. |
HttpRequest |
rawQuery(String query)
Sets the query component to
query, without
any encoding performed. |
HttpRequest |
requestTarget(String requestTarget)
Set the request-target.
|
HttpRequest |
requestTarget(String requestTarget,
Charset encoding)
Set the request-target.
|
default HttpRequest |
setHeader(CharSequence name,
CharSequence value)
Sets a header with the specified
name and value. |
default HttpRequest |
setHeaders(HttpHeaders headers)
Clears the current header entries and copies all header entries of the specified
headers object. |
HttpRequest |
setQueryParameter(String key,
String value)
|
HttpRequest |
setQueryParameters(String key,
Iterable<String> values)
Sets new query parameters with the specified
key and values. |
HttpRequest |
setQueryParameters(String key,
String... values)
Sets new query parameters with the specified
key and values. |
default HttpRequest |
setTrailer(CharSequence name,
CharSequence value)
Sets a trailer with the specified
name and value. |
default HttpRequest |
setTrailers(HttpHeaders trailers)
Clears the current trailer entries and copies all trailer entries of the specified
trailers object. |
BlockingStreamingHttpRequest |
toBlockingStreamingRequest()
Translates this
HttpRequest to a BlockingStreamingHttpRequest. |
StreamingHttpRequest |
toStreamingRequest()
Translates this
HttpRequest to a StreamingHttpRequest. |
HttpHeaders |
trailers()
Gets the trailers.
|
HttpRequest |
version(HttpProtocolVersion version)
Set the protocol version of this
HttpMetaData. |
contentEncoding, effectiveHostAndPort, hasQueryParameter, hasQueryParameter, host, method, path, port, query, queryParameter, queryParameters, queryParameters, queryParametersIterator, queryParametersKeys, queryParametersSize, rawPath, rawQuery, removeQueryParameters, removeQueryParameters, requestTarget, requestTarget, scheme, userInfoBuffer payloadBody()
Buffer.Buffer representation of the underlying payload.@Deprecated default <T> T payloadBody(HttpDeserializer<T> deserializer)
payloadBody(HttpDeserializer2).T - The resulting type of the deserialization operation.deserializer - The function that deserializes the underlying Object.<T> T payloadBody(HttpDeserializer2<T> deserializer)
T - The resulting type of the deserialization operation.deserializer - The function that deserializes the underlying Object.HttpRequest payloadBody(Buffer payloadBody)
HttpRequest with its underlying payload set to payloadBody.payloadBody - the underlying payload.this@Deprecated <T> HttpRequest payloadBody(T pojo, HttpSerializer<T> serializer)
payloadBody(Object, HttpSerializer2).HttpRequest with its underlying payload set to the results of serialization of pojo.T - The type of object to serialize.pojo - The object to serialize.serializer - The HttpSerializer which converts pojo into bytes.this<T> HttpRequest payloadBody(T pojo, HttpSerializer2<T> serializer)
HttpRequest with its underlying payload set to the results of serialization of pojo.T - The type of object to serialize.pojo - The object to serialize.serializer - The HttpSerializer2 which converts pojo into bytes.thisStreamingHttpRequest toStreamingRequest()
HttpRequest to a StreamingHttpRequest.StreamingHttpRequest representation of this HttpRequest.BlockingStreamingHttpRequest toBlockingStreamingRequest()
HttpRequest to a BlockingStreamingHttpRequest.BlockingStreamingHttpRequest representation of this HttpRequest.HttpRequest rawPath(String path)
HttpRequestMetaDatapath, 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 HttpRequestMetaDatapath - the encoded path to set.this.HttpRequest path(String path)
HttpRequestMetaData'/') characters. This allows for path("/abc") without it turning into
'%2Fabc'.path in interface HttpRequestMetaDatapath - the un-encoded path to set.this.HttpRequest appendPathSegments(String... segments)
HttpRequestMetaDataHttpRequestMetaData.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 HttpRequestMetaDatasegments - the un-encoded path to set.this.HttpRequest rawQuery(@Nullable String query)
HttpRequestMetaDataquery, 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 HttpRequestMetaDataquery - the encoded query to set. null will clear the query value (e.g. no ? present in
HttpRequestMetaData.requestTarget().this.HttpRequest query(@Nullable String query)
HttpRequestMetaDataquery in interface HttpRequestMetaDataquery - the un-encoded query to set. null will clear the query value (e.g. no ? present in
HttpRequestMetaData.requestTarget().this.HttpRequest addQueryParameter(String key, String value)
HttpRequestMetaDatakey and value, which will be
percent-encoded if needed.addQueryParameter in interface HttpRequestMetaDatakey - the query parameter key.value - the query parameter value.this.HttpRequest addQueryParameters(String key, Iterable<String> values)
HttpRequestMetaDatakey and values. This method is semantically
equivalent to:
for (T value : values) {
addQueryParameter(key, value);
}
addQueryParameters in interface HttpRequestMetaDatakey - the query parameter key.values - the query parameter values.this.HttpRequest addQueryParameters(String key, String... values)
HttpRequestMetaDatakey and values. This method is semantically
equivalent to:
for (T value : values) {
query.addQueryParameter(key, value);
}
addQueryParameters in interface HttpRequestMetaDatakey - the query parameter key.values - the query parameter values.this.HttpRequest setQueryParameter(String key, String value)
HttpRequestMetaDatakey and value, which will be
percent-encoded if needed.
Any existing query parameters with the same key are overwritten.setQueryParameter in interface HttpRequestMetaDatakey - the query parameter key.value - the query parameter value.this.HttpRequest setQueryParameters(String key, Iterable<String> values)
HttpRequestMetaDatakey and values. This method is equivalent to:
removeQueryParameter(key);
for (T value : values) {
query.addQueryParameter(key, value);
}
setQueryParameters in interface HttpRequestMetaDatakey - the query parameter key.values - the query parameter values.this.HttpRequest setQueryParameters(String key, String... values)
HttpRequestMetaDatakey and values. This method is equivalent to:
removeQueryParameter(key);
for (T value : values) {
query.addQueryParameter(key, value);
}
setQueryParameters in interface HttpRequestMetaDatakey - the query parameter key.values - the query parameter values.this.HttpRequest version(HttpProtocolVersion version)
HttpMetaDataHttpMetaData.version in interface HttpMetaDataversion in interface HttpRequestMetaDataversion - the protocol version to set.this.@Deprecated HttpRequest 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 Identity.identity().encoding in interface HttpMetaDataencoding - The ContentCodec used for the encoding of the payload.this.HttpRequest contentEncoding(@Nullable BufferEncoder encoder)
HttpRequestMetaDataBufferEncoder to use for this request. The value can be used by filters
(such as ContentEncodingHttpRequesterFilter) to apply HttpHeaderNames.CONTENT_ENCODING to the
request.contentEncoding in interface HttpRequestMetaDataencoder - BufferEncoder to use for this request.this.HttpRequest method(HttpRequestMethod method)
HttpRequestMetaDataHttpRequestMethod of this StreamingHttpRequest.method in interface HttpRequestMetaDatamethod - the HttpRequestMethod to set.this.HttpRequest requestTarget(String requestTarget)
HttpRequestMetaDataThis 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 HttpRequestMetaDatarequestTarget - the percent-encoded
request-target to set.this.HttpRequest requestTarget(String requestTarget, Charset encoding)
HttpRequestMetaData
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 HttpRequestMetaDatarequestTarget - the
request-target to set.encoding - the Charset to use to
encode requestTarget before setting the
value.this.default HttpRequest addHeader(CharSequence name, CharSequence value)
HttpMetaDataname and value.addHeader in interface HttpMetaDataaddHeader in interface HttpRequestMetaDataname - the name of the header.value - the value of the header.this.default HttpRequest addHeaders(HttpHeaders headers)
HttpMetaDataheaders object.addHeaders in interface HttpMetaDataaddHeaders in interface HttpRequestMetaDataheaders - the headers to add.this.default HttpRequest setHeader(CharSequence name, CharSequence value)
HttpMetaDataname and value. Any existing headers with the same name are
overwritten.setHeader in interface HttpMetaDatasetHeader in interface HttpRequestMetaDataname - the name of the header.value - the value of the header.this.default HttpRequest setHeaders(HttpHeaders headers)
HttpMetaDataheaders object.setHeaders in interface HttpMetaDatasetHeaders in interface HttpRequestMetaDataheaders - the headers object which contains new values.this.default HttpRequest addCookie(HttpCookiePair cookie)
HttpMetaData
This may result in multiple HttpCookiePairs with same name.
addCookie in interface HttpMetaDataaddCookie in interface HttpRequestMetaDatacookie - the cookie to add.this.default HttpRequest 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 HttpRequestMetaDataname - the name of the cookie.value - the value of the cookie.this.default HttpRequest addSetCookie(HttpSetCookie cookie)
HttpMetaData
This may result in multiple HttpSetCookies with same name.
addSetCookie in interface HttpMetaDataaddSetCookie in interface HttpRequestMetaDatacookie - the cookie to add.this.default HttpRequest 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 HttpRequestMetaDataname - the name of the cookie.value - the value of the cookie.this.default HttpRequest addTrailer(CharSequence name, CharSequence value)
name and value.name - the name of the trailer.value - the value of the trailer.this.default HttpRequest addTrailers(HttpHeaders trailers)
trailer object.trailers - the trailers to add.this.default HttpRequest setTrailer(CharSequence name, CharSequence value)
name and value. Any existing trailers with the same name are
overwritten.name - the name of the trailer.value - the value of the trailer.this.default HttpRequest setTrailers(HttpHeaders trailers)
trailers object.trailers - the trailers object which contains new values.this.HttpRequest context(ContextMap context)
HttpMetaDataHttpMetaData.
Context can be used to associate a state with a request or response message without serializing its state on the wire.
context in interface ContextMapHoldercontext in interface HttpMetaDatacontext in interface HttpRequestMetaDatacontext - the new context for this HttpMetaData.this.HttpHeaders trailers()