public abstract class AbstractServerHttpRequest extends java.lang.Object implements ServerHttpRequest
ServerHttpRequest
implementations.ServerHttpRequest.Builder
Modifier and Type | Field and Description |
---|---|
private MultiValueMap<java.lang.String,HttpCookie> |
cookies |
private HttpHeaders |
headers |
private static java.util.regex.Pattern |
QUERY_PATTERN |
private MultiValueMap<java.lang.String,java.lang.String> |
queryParams |
private java.net.URI |
uri |
Constructor and Description |
---|
AbstractServerHttpRequest(java.net.URI uri,
HttpHeaders headers)
Constructor with the URI and headers for the request.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
decodeQueryParam(java.lang.String value) |
MultiValueMap<java.lang.String,HttpCookie> |
getCookies()
Return a read-only map of cookies sent by the client.
|
HttpHeaders |
getHeaders()
Return the headers of this message.
|
MultiValueMap<java.lang.String,java.lang.String> |
getQueryParams()
Return a read-only map with parsed and decoded query parameter values.
|
java.net.URI |
getURI()
Return the URI of the request.
|
protected abstract MultiValueMap<java.lang.String,HttpCookie> |
initCookies()
Obtain the cookies from the underlying "native" request and adapt those to
an
HttpCookie map. |
protected MultiValueMap<java.lang.String,java.lang.String> |
initQueryParams()
A method for parsing of the query into name-value pairs.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContextPath, getRemoteAddress, mutate
getMethod
getBody
private static final java.util.regex.Pattern QUERY_PATTERN
private final java.net.URI uri
private final HttpHeaders headers
private MultiValueMap<java.lang.String,java.lang.String> queryParams
private MultiValueMap<java.lang.String,HttpCookie> cookies
public AbstractServerHttpRequest(java.net.URI uri, HttpHeaders headers)
uri
- the URI for the requestheaders
- the headers for the requestpublic java.net.URI getURI()
HttpRequest
getURI
in interface HttpRequest
null
)public HttpHeaders getHeaders()
HttpMessage
getHeaders
in interface HttpMessage
null
)public MultiValueMap<java.lang.String,java.lang.String> getQueryParams()
ServerHttpRequest
getQueryParams
in interface ServerHttpRequest
protected MultiValueMap<java.lang.String,java.lang.String> initQueryParams()
Note that this method is invoked lazily on first access to
getQueryParams()
. The invocation is not synchronized but the
parsing is thread-safe nevertheless.
private java.lang.String decodeQueryParam(java.lang.String value)
public MultiValueMap<java.lang.String,HttpCookie> getCookies()
ServerHttpRequest
getCookies
in interface ServerHttpRequest
protected abstract MultiValueMap<java.lang.String,HttpCookie> initCookies()
HttpCookie
map. The return value is turned into an immutable
map and cached.
Note that this method is invoked lazily on access to
getCookies()
. Sub-classes should synchronize cookie
initialization if the underlying "native" request does not provide
thread-safe access to cookie data.