public interface HttpRequestMetaData extends HttpMetaData
Modifier and Type | Method and Description |
---|---|
default HttpRequestMetaData |
addCookie(java.lang.CharSequence name,
java.lang.CharSequence value)
|
default HttpRequestMetaData |
addCookie(HttpCookiePair cookie)
Adds a cookie.
|
default HttpRequestMetaData |
addHeader(java.lang.CharSequence name,
java.lang.CharSequence value)
Adds a new header with the specified
name and value . |
default HttpRequestMetaData |
addHeaders(HttpHeaders headers)
Adds all header names and values of
headers object. |
HttpRequestMetaData |
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. |
HttpRequestMetaData |
addQueryParameters(java.lang.String key,
java.lang.Iterable<java.lang.String> values)
Adds new query parameters with the specified
key and values . |
HttpRequestMetaData |
addQueryParameters(java.lang.String key,
java.lang.String... values)
Adds new query parameters with the specified
key and values . |
default HttpRequestMetaData |
addSetCookie(java.lang.CharSequence name,
java.lang.CharSequence value)
|
default HttpRequestMetaData |
addSetCookie(HttpSetCookie cookie)
Adds a set-cookie.
|
HttpRequestMetaData |
appendPathSegments(java.lang.String... segments)
Appends segments to the current
path() , performing encoding of each segment
(including ('/' ) characters) according
to percent-encoding. |
java.lang.String |
effectiveHost()
|
int |
effectivePort()
|
default boolean |
hasQueryParameter(java.lang.String key)
Returns
true if a query parameter with the key exists, false otherwise. |
boolean |
hasQueryParameter(java.lang.String key,
java.lang.String value)
Returns
true if a query parameter with the key and value exists, false otherwise. |
java.lang.String |
host()
The host component derived
from
requestTarget() . |
HttpRequestMethod |
method()
Returns the
HttpRequestMethod of this StreamingHttpRequest . |
HttpRequestMetaData |
method(HttpRequestMethod method)
Set the
HttpRequestMethod of this StreamingHttpRequest . |
java.lang.String |
path()
Get an equivalent value as
rawPath() but decoded according
to percent-encoding. |
HttpRequestMetaData |
path(java.lang.String path)
Sets the path, performing encoding according
to percent-encoding, except for forward-slash
(
'/' ) characters. |
int |
port()
The port component derived
from
requestTarget() . |
java.lang.String |
queryParameter(java.lang.String key)
Returns the value of a query parameter with the specified key.
|
java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> |
queryParameters()
Returns all query parameters as key/value pairs.
|
java.lang.Iterable<java.lang.String> |
queryParameters(java.lang.String key)
Returns all values for the query parameter with the specified key.
|
java.util.Iterator<java.lang.String> |
queryParametersIterator(java.lang.String key)
Returns all values for the query parameter with the specified key.
|
java.util.Set<java.lang.String> |
queryParametersKeys()
Returns a
Set of all query parameter keys. |
int |
queryParametersSize()
Returns the number of query parameters.
|
java.lang.String |
rawPath()
The path component derived
from
requestTarget() . |
HttpRequestMetaData |
rawPath(java.lang.String path)
Sets the path to
path , without any encoding performed. |
java.lang.String |
rawQuery()
The query component derived
from
requestTarget() . |
HttpRequestMetaData |
rawQuery(java.lang.String query)
Sets the query component to
query , without
any encoding performed. |
boolean |
removeQueryParameters(java.lang.String key)
Removes all query parameters with the specified
key . |
boolean |
removeQueryParameters(java.lang.String key,
java.lang.String value)
Removes all query parameters with the specified
key and value . |
java.lang.String |
requestTarget()
The request-target.
|
HttpRequestMetaData |
requestTarget(java.lang.String requestTarget)
Set the request-target.
|
java.lang.String |
scheme()
The scheme component derived
from
requestTarget() in lower case. |
default HttpRequestMetaData |
setHeader(java.lang.CharSequence name,
java.lang.CharSequence value)
Sets a header with the specified
name and value . |
default HttpRequestMetaData |
setHeaders(HttpHeaders headers)
Clears the current header entries and copies all header entries of the specified
headers object. |
HttpRequestMetaData |
setQueryParameter(java.lang.String key,
java.lang.String value)
|
HttpRequestMetaData |
setQueryParameters(java.lang.String key,
java.lang.Iterable<java.lang.String> values)
Sets new query parameters with the specified
key and values . |
HttpRequestMetaData |
setQueryParameters(java.lang.String key,
java.lang.String... values)
Sets new query parameters with the specified
key and values . |
java.lang.String |
userInfo()
The user information component derived
from
requestTarget() . |
HttpRequestMetaData |
version(HttpProtocolVersion version)
Set the protocol version of this
HttpMetaData . |
headers, toString, toString, version
HttpRequestMethod method()
HttpRequestMethod
of this StreamingHttpRequest
.HttpRequestMethod
of this StreamingHttpRequest
HttpRequestMetaData method(HttpRequestMethod method)
HttpRequestMethod
of this StreamingHttpRequest
.method
- the HttpRequestMethod
to set.this
.java.lang.String requestTarget()
No decoding has been done on the request-target.
No decoding has been done on the request-target.
HttpRequestMetaData requestTarget(java.lang.String requestTarget)
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 path()
, rawQuery()
, etc.
requestTarget
- the percent-encoded
request-target to set.this
.@Nullable java.lang.String scheme()
requestTarget()
in lower case.requestTarget()
in lower case, or null
if none can be derived.@Nullable java.lang.String userInfo()
requestTarget()
.requestTarget()
, or null
if none can be derived.@Nullable java.lang.String host()
requestTarget()
.requestTarget()
, or null
if none can be derived.int port()
requestTarget()
.requestTarget()
,
or <0
if none can be derived.java.lang.String rawPath()
requestTarget()
.
No decoding has been done on the query component: the value is provided as specified in the request target.
requestTarget()
.
No decoding has been done on the query component: the value is provided as specified in the request target.
java.lang.String path()
rawPath()
but decoded according
to percent-encoding.rawPath()
but decoded according
to percent-encoding.HttpRequestMetaData rawPath(java.lang.String path)
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 requestTarget(String)
.
path
- the encoded path to set.this
.HttpRequestMetaData path(java.lang.String path)
'/'
) characters. This allows for path("/abc")
without it turning into
'%2Fabc'
.path
- the un-encoded path to set.this
.HttpRequestMetaData appendPathSegments(java.lang.String... segments)
path()
, performing encoding of each segment
(including ('/'
) characters) according
to percent-encoding.
A /
is used to separate each segment and between the current path()
and the following segments.segments
- the un-encoded path to set.this
.java.lang.String rawQuery()
requestTarget()
.
No decoding has been done on the query component: the value is provided as specified in the request target.
requestTarget()
.
No decoding has been done on the query component: the value is provided as specified in the request target.
HttpRequestMetaData rawQuery(java.lang.String query)
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 requestTarget(String)
.
query
- the encoded query to set.this
.@Nullable java.lang.String queryParameter(java.lang.String key)
key
- the key of the query parameter to retrieve.null
if there's no such key.java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> queryParameters()
Iterable
of query parameter key/value pairs or an empty Iterable
if none present.java.lang.Iterable<java.lang.String> queryParameters(java.lang.String key)
key
- the key of the query parameter to retrieve.Iterable
of query parameter values or an empty Iterable
if no values are found.java.util.Iterator<java.lang.String> queryParametersIterator(java.lang.String key)
key
- the key of the query parameter to retrieve.Iterator
of query parameter values or an empty Iterator
if no values are found.java.util.Set<java.lang.String> queryParametersKeys()
Set
of all query parameter keys. The returned Set
cannot be modified.Set
of all query parameter keys. The returned Set
cannot be modified.default boolean hasQueryParameter(java.lang.String key)
true
if a query parameter with the key
exists, false
otherwise.key
- the query parameter name.true
if key
exists.boolean hasQueryParameter(java.lang.String key, java.lang.String value)
true
if a query parameter with the key
and value
exists, false
otherwise.key
- the query parameter key.value
- the query parameter value of the query parameter to find.true
if a key
, value
pair exists.int queryParametersSize()
HttpRequestMetaData addQueryParameter(java.lang.String key, java.lang.String value)
key
and value
, which will be
percent-encoded if needed.key
- the query parameter key.value
- the query parameter value.this
.HttpRequestMetaData addQueryParameters(java.lang.String key, java.lang.Iterable<java.lang.String> values)
key
and values
. This method is semantically
equivalent to:
for (T value : values) { addQueryParameter(key, value); }
key
- the query parameter key.values
- the query parameter values.this
.HttpRequestMetaData addQueryParameters(java.lang.String key, java.lang.String... values)
key
and values
. This method is semantically
equivalent to:
for (T value : values) { query.addQueryParameter(key, value); }
key
- the query parameter key.values
- the query parameter values.this
.HttpRequestMetaData setQueryParameter(java.lang.String key, java.lang.String value)
key
and value
, which will be
percent-encoded if needed.
Any existing query parameters with the same key are overwritten.key
- the query parameter key.value
- the query parameter value.this
.HttpRequestMetaData setQueryParameters(java.lang.String key, java.lang.Iterable<java.lang.String> values)
key
and values
. This method is equivalent to:
removeQueryParameter(key); for (T value : values) { query.addQueryParameter(key, value); }
key
- the query parameter key.values
- the query parameter values.this
.HttpRequestMetaData setQueryParameters(java.lang.String key, java.lang.String... values)
key
and values
. This method is equivalent to:
removeQueryParameter(key); for (T value : values) { query.addQueryParameter(key, value); }
key
- the query parameter key.values
- the query parameter values.this
.boolean removeQueryParameters(java.lang.String key)
key
.key
- the query parameter key.true
if at least one entry has been removed.boolean removeQueryParameters(java.lang.String key, java.lang.String value)
key
and value
.key
- the query parameter key.value
- the query parameter value.true
if at least one entry has been removed.@Nullable java.lang.String effectiveHost()
requestTarget()
and the Host
header field value. This is the scheme component to use
when computing an effective request URI.requestTarget()
and the Host
header field value, or null
if none can be derived.int effectivePort()
requestTarget()
and the Host
header field value. This is the scheme component to use
when computing an effective request URI.requestTarget()
, and the Host
header field value, or <0
if none can be derived.HttpRequestMetaData version(HttpProtocolVersion version)
HttpMetaData
HttpMetaData
.version
in interface HttpMetaData
version
- the protocol version to set.this
.default HttpRequestMetaData addHeader(java.lang.CharSequence name, java.lang.CharSequence value)
HttpMetaData
name
and value
.addHeader
in interface HttpMetaData
name
- the name of the header.value
- the value of the header.this
.default HttpRequestMetaData addHeaders(HttpHeaders headers)
HttpMetaData
headers
object.addHeaders
in interface HttpMetaData
headers
- the headers to add.this
.default HttpRequestMetaData 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
name
- the name of the header.value
- the value of the header.this
.default HttpRequestMetaData setHeaders(HttpHeaders headers)
HttpMetaData
headers
object.setHeaders
in interface HttpMetaData
headers
- the headers object which contains new values.this
.default HttpRequestMetaData addCookie(HttpCookiePair cookie)
HttpMetaData
This may result in multiple HttpCookiePair
s with same name.
addCookie
in interface HttpMetaData
cookie
- the cookie to add.this
.default HttpRequestMetaData 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
name
- the name of the cookie.value
- the value of the cookie.this
.default HttpRequestMetaData addSetCookie(HttpSetCookie cookie)
HttpMetaData
This may result in multiple HttpSetCookie
s with same name.
addSetCookie
in interface HttpMetaData
cookie
- the cookie to add.this
.default HttpRequestMetaData 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
name
- the name of the cookie.value
- the value of the cookie.this
.