Interface HttpRequestMetaData
- All Superinterfaces:
ContextMapHolder
,HttpMetaData
- All Known Subinterfaces:
BlockingStreamingHttpRequest
,HttpRequest
,StreamingHttpRequest
-
Method Summary
Modifier and TypeMethodDescriptiondefault HttpRequestMetaData
addCookie
(HttpCookiePair cookie) Adds a cookie.default HttpRequestMetaData
addCookie
(CharSequence name, CharSequence value) default HttpRequestMetaData
addHeader
(CharSequence name, CharSequence value) Adds a new header with the specifiedname
andvalue
.default HttpRequestMetaData
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 HttpRequestMetaData
addSetCookie
(HttpSetCookie cookie) Adds a set-cookie.default HttpRequestMetaData
addSetCookie
(CharSequence name, CharSequence value) appendPathSegments
(String... segments) Appends segments to the currentpath()
, performing encoding of each segment (including ('/'
) characters) according to percent-encoding.Get theBufferEncoder
to use for this request.contentEncoding
(BufferEncoder encoder) Set theBufferEncoder
to use for this request.context
(ContextMap context) Sets a context for thisHttpMetaData
.default String
fragment()
Returns the fragment part of the request target.default HttpRequestMetaData
Sets the fragment part of the request target.default boolean
hasQueryParameter
(String key) Returnstrue
if a query parameter with thekey
exists,false
otherwise.boolean
hasQueryParameter
(String key, String value) Returnstrue
if a query parameter with thekey
andvalue
exists,false
otherwise.host()
The host component derived fromrequestTarget()
.method()
Returns theHttpRequestMethod
of thisStreamingHttpRequest
.method
(HttpRequestMethod method) Set theHttpRequestMethod
of thisStreamingHttpRequest
.path()
Get an equivalent value asrawPath()
but decoded according to percent-encoding.Sets the path, performing encoding according to percent-encoding, except for forward-slash ('/'
) characters.int
port()
The port component derived fromrequestTarget()
.query()
Get an equivalent value asrawQuery()
but decoded according to rfc3986, Query.Sets the path, performing encoding according to rfc3986, Query.queryParameter
(String key) Returns the value of a query parameter with the specified key.Returns all query parameters as key/value pairs.queryParameters
(String key) Returns all values for the query parameter with the specified key.Returns all values for the query parameter with the specified key.Returns aSet
of all query parameter keys.int
Returns the number of query parameters.rawPath()
The path component derived fromrequestTarget()
.Sets the path topath
, without any encoding performed.rawQuery()
The query component derived fromrequestTarget()
.Sets the query component toquery
, without any encoding performed.boolean
Removes all query parameters with the specifiedkey
.boolean
removeQueryParameters
(String key, String value) Removes all query parameters with the specifiedkey
andvalue
.The request-target.requestTarget
(String requestTarget) Set the request-target.requestTarget
(String requestTarget, Charset encoding) Set the request-target.requestTarget
(Charset encoding) The request-target.scheme()
The scheme component derived fromrequestTarget()
in lower case.default HttpRequestMetaData
setHeader
(CharSequence name, CharSequence value) Sets a header with the specifiedname
andvalue
.default HttpRequestMetaData
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
.userInfo()
The user information component derived fromrequestTarget()
.version
(HttpProtocolVersion version) Set the protocol version of thisHttpMetaData
.
-
Method Details
-
method
HttpRequestMethod method()Returns theHttpRequestMethod
of thisStreamingHttpRequest
.- Returns:
- The
HttpRequestMethod
of thisStreamingHttpRequest
-
method
Set theHttpRequestMethod
of thisStreamingHttpRequest
.- Parameters:
method
- theHttpRequestMethod
to set.- Returns:
this
.
-
requestTarget
String requestTarget()The request-target.No decoding has been done on the request-target.
- Returns:
- The request-target.
No decoding has been done on the request-target.
-
requestTarget
The request-target.- Parameters:
encoding
- theCharset
to use to decode the request-target.- Returns:
- The request-target.
-
requestTarget
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 aspath()
,rawQuery()
, etc.- Parameters:
requestTarget
- the percent-encoded request-target to set.- Returns:
this
.
-
requestTarget
Set the request-target.This may result in clearing of internal caches used by methods that are derived from the
request-target
, such aspath()
,rawQuery()
, etc.- Parameters:
requestTarget
- the request-target to set.encoding
- theCharset
to use to encoderequestTarget
before setting the value.- Returns:
this
.
-
scheme
The scheme component derived fromrequestTarget()
in lower case.- Returns:
- The scheme component derived
from
requestTarget()
in lower case, ornull
if none can be derived.
-
userInfo
The user information component derived fromrequestTarget()
.- Returns:
- The user information component derived
from
requestTarget()
, ornull
if none can be derived.
-
host
The host component derived fromrequestTarget()
.- Returns:
- The host component derived
from
requestTarget()
, ornull
if none can be derived.
-
port
int port()The port component derived fromrequestTarget()
.- Returns:
- The port component derived
from
requestTarget()
, or<0
if none can be derived.
-
rawPath
String rawPath()The path component derived fromrequestTarget()
.No decoding has been done on the query component: the value is provided as specified in the request target.
- Returns:
- The path component derived
from
requestTarget()
.No decoding has been done on the query component: the value is provided as specified in the request target.
-
path
String path()Get an equivalent value asrawPath()
but decoded according to percent-encoding.- Returns:
- an equivalent value as
rawPath()
but decoded according to percent-encoding.
-
rawPath
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
requestTarget(String)
.- Parameters:
path
- the encoded path to set.- Returns:
this
.
-
path
Sets the path, performing encoding according to percent-encoding, except for forward-slash ('/'
) characters. This allows forpath("/abc")
without it turning into'%2Fabc'
.- Parameters:
path
- the un-encoded path to set.- Returns:
this
.
-
appendPathSegments
Appends segments to the currentpath()
, performing encoding of each segment (including ('/'
) characters) according to percent-encoding. A/
is used to separate each segment and between the currentpath()
and the following segments.- Parameters:
segments
- the un-encoded path to set.- Returns:
this
.
-
rawQuery
The query component derived fromrequestTarget()
.No decoding has been done on the query component: the value is provided as specified in the request target.
- Returns:
- The query component derived
from
requestTarget()
.No decoding has been done on the query component: the value is provided as specified in the request target.
-
query
Get an equivalent value asrawQuery()
but decoded according to rfc3986, Query.- Returns:
- an equivalent value as
rawQuery()
but decoded according to rfc3986, Query.
-
rawQuery
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
requestTarget(String)
.- Parameters:
query
- the encoded query to set.null
will clear the query value (e.g. no?
present inrequestTarget()
.- Returns:
this
.
-
query
Sets the path, performing encoding according to rfc3986, Query.- Parameters:
query
- the un-encoded query to set.null
will clear the query value (e.g. no?
present inrequestTarget()
.- Returns:
this
.
-
queryParameter
Returns the value of a query parameter with the specified key. If there is more than one value for the specified key, the first value in insertion order is returned.- Parameters:
key
- the key of the query parameter to retrieve.- Returns:
- the first query parameter value if the key is found.
null
if there's no such key.
-
queryParameters
Returns all query parameters as key/value pairs. -
queryParameters
Returns all values for the query parameter with the specified key. -
queryParametersIterator
Returns all values for the query parameter with the specified key. -
queryParametersKeys
-
hasQueryParameter
Returnstrue
if a query parameter with thekey
exists,false
otherwise.- Parameters:
key
- the query parameter name.- Returns:
true
ifkey
exists.
-
hasQueryParameter
Returnstrue
if a query parameter with thekey
andvalue
exists,false
otherwise.- Parameters:
key
- the query parameter key.value
- the query parameter value of the query parameter to find.- Returns:
true
if akey
,value
pair exists.
-
queryParametersSize
int queryParametersSize()Returns the number of query parameters.- Returns:
- the number of query parameters.
-
addQueryParameter
Adds a new query parameter with the specifiedkey
andvalue
, which will be percent-encoded if needed.- Parameters:
key
- the query parameter key.value
- the query parameter value.- Returns:
this
.
-
addQueryParameters
Adds new query parameters with the specifiedkey
andvalues
. This method is semantically equivalent to:for (T value : values) { addQueryParameter(key, value); }
- Parameters:
key
- the query parameter key.values
- the query parameter values.- Returns:
this
.
-
addQueryParameters
Adds new query parameters with the specifiedkey
andvalues
. This method is semantically equivalent to:for (T value : values) { query.addQueryParameter(key, value); }
- Parameters:
key
- the query parameter key.values
- the query parameter values.- Returns:
this
.
-
setQueryParameter
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.- Parameters:
key
- the query parameter key.value
- the query parameter value.- Returns:
this
.
-
setQueryParameters
Sets new query parameters with the specifiedkey
andvalues
. This method is equivalent to:removeQueryParameter(key); for (T value : values) { query.addQueryParameter(key, value); }
- Parameters:
key
- the query parameter key.values
- the query parameter values.- Returns:
this
.
-
setQueryParameters
Sets new query parameters with the specifiedkey
andvalues
. This method is equivalent to:removeQueryParameter(key); for (T value : values) { query.addQueryParameter(key, value); }
- Parameters:
key
- the query parameter key.values
- the query parameter values.- Returns:
this
.
-
removeQueryParameters
Removes all query parameters with the specifiedkey
.- Parameters:
key
- the query parameter key.- Returns:
true
if at least one entry has been removed.
-
removeQueryParameters
Removes all query parameters with the specifiedkey
andvalue
.- Parameters:
key
- the query parameter key.value
- the query parameter value.- Returns:
true
if at least one entry has been removed.
-
fragment
Returns the fragment part of the request target.- Returns:
- the fragment part of the request target.
-
fragment
Sets the fragment part of the request target.- Parameters:
fragment
- the fragment to set.- Returns:
this
.
-
effectiveHostAndPort
Get the host and port components of the effective request URI. The port component will be<0
if none can be derived. This method typically pulls information fromrequestTarget()
andHttpHeaderNames.HOST
header.- Returns:
- The host and
port components
of the effective request URI.
null
if the request doesn't provide enough info to derive the host/port.
-
contentEncoding
Get theBufferEncoder
to use for this request. The value can be used by filters (such asContentEncodingHttpRequesterFilter
) to applyHttpHeaderNames.CONTENT_ENCODING
to the request.- Returns:
- the
BufferEncoder
to use for this request.
-
contentEncoding
Set theBufferEncoder
to use for this request. The value can be used by filters (such asContentEncodingHttpRequesterFilter
) to applyHttpHeaderNames.CONTENT_ENCODING
to the request.- Parameters:
encoder
-BufferEncoder
to use for this request.- Returns:
this
.
-
version
Description copied from interface:HttpMetaData
Set the protocol version of thisHttpMetaData
.- Specified by:
version
in interfaceHttpMetaData
- Parameters:
version
- the protocol version to set.- Returns:
this
.
-
addHeader
Description copied from interface:HttpMetaData
Adds a new header with the specifiedname
andvalue
.- Specified by:
addHeader
in interfaceHttpMetaData
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- Parameters:
context
- the new context for thisHttpMetaData
.- Returns:
this
.
-