Interface HttpRequestMetaData
- All Superinterfaces:
ContextMapHolder,HttpMetaData
- All Known Subinterfaces:
BlockingStreamingHttpRequest,HttpRequest,StreamingHttpRequest
-
Method Summary
Modifier and TypeMethodDescriptiondefault HttpRequestMetaDataaddCookie(HttpCookiePair cookie) Adds a cookie.default HttpRequestMetaDataaddCookie(CharSequence name, CharSequence value) default HttpRequestMetaDataaddHeader(CharSequence name, CharSequence value) Adds a new header with the specifiednameandvalue.default HttpRequestMetaDataaddHeaders(HttpHeaders headers) Adds all header names and values ofheadersobject.addQueryParameter(String key, String value) Adds a new query parameter with the specifiedkeyandvalue, which will be percent-encoded if needed.addQueryParameters(String key, Iterable<String> values) Adds new query parameters with the specifiedkeyandvalues.addQueryParameters(String key, String... values) Adds new query parameters with the specifiedkeyandvalues.default HttpRequestMetaDataaddSetCookie(HttpSetCookie cookie) Adds a set-cookie.default HttpRequestMetaDataaddSetCookie(CharSequence name, CharSequence value) appendPathSegments(String... segments) Appends segments to the currentpath(), performing encoding of each segment (including ('/') characters) according to percent-encoding.Get theBufferEncoderto use for this request.contentEncoding(BufferEncoder encoder) Set theBufferEncoderto use for this request.context(ContextMap context) Sets a context for thisHttpMetaData.default Stringfragment()Returns the fragment part of the request target.default HttpRequestMetaDataSets the fragment part of the request target.default booleanhasQueryParameter(String key) Returnstrueif a query parameter with thekeyexists,falseotherwise.booleanhasQueryParameter(String key, String value) Returnstrueif a query parameter with thekeyandvalueexists,falseotherwise.host()The host component derived fromrequestTarget().method()Returns theHttpRequestMethodof thisStreamingHttpRequest.method(HttpRequestMethod method) Set theHttpRequestMethodof 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.intport()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 aSetof all query parameter keys.intReturns 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.booleanRemoves all query parameters with the specifiedkey.booleanremoveQueryParameters(String key, String value) Removes all query parameters with the specifiedkeyandvalue.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 HttpRequestMetaDatasetHeader(CharSequence name, CharSequence value) Sets a header with the specifiednameandvalue.default HttpRequestMetaDatasetHeaders(HttpHeaders headers) Clears the current header entries and copies all header entries of the specifiedheadersobject.setQueryParameter(String key, String value) setQueryParameters(String key, Iterable<String> values) Sets new query parameters with the specifiedkeyandvalues.setQueryParameters(String key, String... values) Sets new query parameters with the specifiedkeyandvalues.userInfo()The user information component derived fromrequestTarget().version(HttpProtocolVersion version) Set the protocol version of thisHttpMetaData.
-
Method Details
-
method
HttpRequestMethod method()Returns theHttpRequestMethodof thisStreamingHttpRequest.- Returns:
- The
HttpRequestMethodof thisStreamingHttpRequest
-
method
Set theHttpRequestMethodof thisStreamingHttpRequest.- Parameters:
method- theHttpRequestMethodto 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- theCharsetto 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- theCharsetto use to encoderequestTargetbefore setting the value.- Returns:
this.
-
scheme
The scheme component derived fromrequestTarget()in lower case.- Returns:
- The scheme component derived
from
requestTarget()in lower case, ornullif none can be derived.
-
userInfo
The user information component derived fromrequestTarget().- Returns:
- The user information component derived
from
requestTarget(), ornullif none can be derived.
-
host
The host component derived fromrequestTarget().- Returns:
- The host component derived
from
requestTarget(), ornullif none can be derived.
-
port
int port()The port component derived fromrequestTarget().- Returns:
- The port component derived
from
requestTarget(), or<0if 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.nullwill 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.nullwill 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.
nullif 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
Returnstrueif a query parameter with thekeyexists,falseotherwise.- Parameters:
key- the query parameter name.- Returns:
trueifkeyexists.
-
hasQueryParameter
Returnstrueif a query parameter with thekeyandvalueexists,falseotherwise.- Parameters:
key- the query parameter key.value- the query parameter value of the query parameter to find.- Returns:
trueif akey,valuepair exists.
-
queryParametersSize
int queryParametersSize()Returns the number of query parameters.- Returns:
- the number of query parameters.
-
addQueryParameter
Adds a new query parameter with the specifiedkeyandvalue, 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 specifiedkeyandvalues. 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 specifiedkeyandvalues. 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 specifiedkeyandvalue, 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 specifiedkeyandvalues. 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 specifiedkeyandvalues. 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:
trueif at least one entry has been removed.
-
removeQueryParameters
Removes all query parameters with the specifiedkeyandvalue.- Parameters:
key- the query parameter key.value- the query parameter value.- Returns:
trueif 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<0if none can be derived. This method typically pulls information fromrequestTarget()andHttpHeaderNames.HOSTheader.- Returns:
- The host and
port components
of the effective request URI.
nullif the request doesn't provide enough info to derive the host/port.
-
contentEncoding
Get theBufferEncoderto use for this request. The value can be used by filters (such asContentEncodingHttpRequesterFilter) to applyHttpHeaderNames.CONTENT_ENCODINGto the request.- Returns:
- the
BufferEncoderto use for this request.
-
contentEncoding
Set theBufferEncoderto use for this request. The value can be used by filters (such asContentEncodingHttpRequesterFilter) to applyHttpHeaderNames.CONTENT_ENCODINGto the request.- Parameters:
encoder-BufferEncoderto use for this request.- Returns:
this.
-
version
Description copied from interface:HttpMetaDataSet the protocol version of thisHttpMetaData.- Specified by:
versionin interfaceHttpMetaData- Parameters:
version- the protocol version to set.- Returns:
this.
-
addHeader
Description copied from interface:HttpMetaDataAdds a new header with the specifiednameandvalue.- Specified by:
addHeaderin interfaceHttpMetaData- Parameters:
name- the name of the header.value- the value of the header.- Returns:
this.
-
addHeaders
Description copied from interface:HttpMetaDataAdds all header names and values ofheadersobject.- Specified by:
addHeadersin interfaceHttpMetaData- Parameters:
headers- the headers to add.- Returns:
this.
-
setHeader
Description copied from interface:HttpMetaDataSets a header with the specifiednameandvalue. Any existing headers with the same name are overwritten.- Specified by:
setHeaderin interfaceHttpMetaData- Parameters:
name- the name of the header.value- the value of the header.- Returns:
this.
-
setHeaders
Description copied from interface:HttpMetaDataClears the current header entries and copies all header entries of the specifiedheadersobject.- Specified by:
setHeadersin interfaceHttpMetaData- Parameters:
headers- the headers object which contains new values.- Returns:
this.
-
addCookie
Description copied from interface:HttpMetaDataAdds a cookie.This may result in multiple
HttpCookiePairs with same name.- Specified by:
addCookiein interfaceHttpMetaData- Parameters:
cookie- the cookie to add.- Returns:
this.
-
addCookie
Description copied from interface:HttpMetaDataAdds a cookie with the specifiednameandvalue.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.- Specified by:
addCookiein interfaceHttpMetaData- Parameters:
name- the name of the cookie.value- the value of the cookie.- Returns:
this.
-
addSetCookie
Description copied from interface:HttpMetaDataAdds a set-cookie.This may result in multiple
HttpSetCookies with same name.- Specified by:
addSetCookiein interfaceHttpMetaData- Parameters:
cookie- the cookie to add.- Returns:
this.
-
addSetCookie
Description copied from interface:HttpMetaDataAdds a set-cookie with the specifiednameandvalue.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.- Specified by:
addSetCookiein interfaceHttpMetaData- Parameters:
name- the name of the cookie.value- the value of the cookie.- Returns:
this.
-
context
Description copied from interface:HttpMetaDataSets 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:
contextin interfaceContextMapHolder- Specified by:
contextin interfaceHttpMetaData- Parameters:
context- the new context for thisHttpMetaData.- Returns:
this.
-