public interface HttpRequest extends HttpRequestMetaData
Object
.Modifier and Type | Method and Description |
---|---|
default HttpRequest |
addCookie(java.lang.CharSequence name,
java.lang.CharSequence value)
|
default HttpRequest |
addCookie(HttpCookiePair cookie)
Adds a cookie.
|
default HttpRequest |
addHeader(java.lang.CharSequence name,
java.lang.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(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. |
HttpRequest |
addQueryParameters(java.lang.String key,
java.lang.Iterable<java.lang.String> values)
Adds new query parameters with the specified
key and values . |
HttpRequest |
addQueryParameters(java.lang.String key,
java.lang.String... values)
Adds new query parameters with the specified
key and values . |
default HttpRequest |
addSetCookie(java.lang.CharSequence name,
java.lang.CharSequence value)
|
default HttpRequest |
addSetCookie(HttpSetCookie cookie)
Adds a set-cookie.
|
default HttpRequest |
addTrailer(java.lang.CharSequence name,
java.lang.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(java.lang.String... segments)
Appends segments to the current
HttpRequestMetaData.path() , performing encoding of each segment
(including ('/' ) characters) according
to percent-encoding. |
HttpRequest |
method(HttpRequestMethod method)
Set the
HttpRequestMethod of this StreamingHttpRequest . |
HttpRequest |
path(java.lang.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)
Gets and deserializes the payload body.
|
<T> HttpRequest |
payloadBody(T pojo,
HttpSerializer<T> serializer)
Returns an
HttpRequest with its underlying payload set to the results of serialization of pojo . |
HttpRequest |
rawPath(java.lang.String path)
Sets the path to
path , without any encoding performed. |
HttpRequest |
rawQuery(java.lang.String query)
Sets the query component to
query , without
any encoding performed. |
HttpRequest |
requestTarget(java.lang.String requestTarget)
Set the request-target.
|
default HttpRequest |
setHeader(java.lang.CharSequence name,
java.lang.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(java.lang.String key,
java.lang.String value)
|
HttpRequest |
setQueryParameters(java.lang.String key,
java.lang.Iterable<java.lang.String> values)
Sets new query parameters with the specified
key and values . |
HttpRequest |
setQueryParameters(java.lang.String key,
java.lang.String... values)
Sets new query parameters with the specified
key and values . |
default HttpRequest |
setTrailer(java.lang.CharSequence name,
java.lang.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 . |
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
Buffer payloadBody()
Buffer
.Buffer
representation of the underlying payload.default <T> T payloadBody(HttpDeserializer<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
<T> HttpRequest payloadBody(T pojo, HttpSerializer<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 HttpSerializer
which converts pojo
into bytes.this
StreamingHttpRequest toStreamingRequest()
HttpRequest
to a StreamingHttpRequest
.StreamingHttpRequest
representation of this HttpRequest
.BlockingStreamingHttpRequest toBlockingStreamingRequest()
HttpRequest
to a BlockingStreamingHttpRequest
.BlockingStreamingHttpRequest
representation of this HttpRequest
.HttpRequest 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
.HttpRequest 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
.HttpRequest 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
.HttpRequest 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
.HttpRequest 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
.HttpRequest 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
.HttpRequest 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
.HttpRequest 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
.HttpRequest 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
.HttpRequest 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
.HttpRequest version(HttpProtocolVersion version)
HttpMetaData
HttpMetaData
.version
in interface HttpMetaData
version
in interface HttpRequestMetaData
version
- the protocol version to set.this
.HttpRequest method(HttpRequestMethod method)
HttpRequestMetaData
HttpRequestMethod
of this StreamingHttpRequest
.method
in interface HttpRequestMetaData
method
- the HttpRequestMethod
to set.this
.HttpRequest 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 HttpRequest 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 HttpRequest addHeaders(HttpHeaders headers)
HttpMetaData
headers
object.addHeaders
in interface HttpMetaData
addHeaders
in interface HttpRequestMetaData
headers
- the headers to add.this
.default HttpRequest 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 HttpRequest setHeaders(HttpHeaders headers)
HttpMetaData
headers
object.setHeaders
in interface HttpMetaData
setHeaders
in interface HttpRequestMetaData
headers
- the headers object which contains new values.this
.default HttpRequest 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 HttpRequest 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 HttpRequest 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 HttpRequest 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
.default HttpRequest addTrailer(java.lang.CharSequence name, java.lang.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(java.lang.CharSequence name, java.lang.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
.HttpHeaders trailers()