public abstract class AbstractServerHttpRequest extends Object implements ServerHttpRequest
ServerHttpRequest implementations.ServerHttpRequest.Builder| Constructor and Description |
|---|
AbstractServerHttpRequest(URI uri,
String contextPath,
HttpHeaders headers)
Constructor with the URI and headers for the request.
|
AbstractServerHttpRequest(URI uri,
String contextPath,
MultiValueMap<String,String> headers)
Constructor with the URI and headers for the request.
|
| Modifier and Type | Method and Description |
|---|---|
MultiValueMap<String,HttpCookie> |
getCookies()
Return a read-only map of cookies sent by the client.
|
HttpHeaders |
getHeaders()
Return the headers of this message.
|
String |
getId()
Return an id that represents the underlying connection, if available,
or the request for the purpose of correlating log messages.
|
abstract <T> T |
getNativeRequest()
Return the underlying server response.
|
RequestPath |
getPath()
Returns a structured representation of the full request path up to but
not including the
query. |
MultiValueMap<String,String> |
getQueryParams()
Return a read-only map with parsed and decoded query parameter values.
|
SslInfo |
getSslInfo()
Return the SSL session information if the request has been transmitted
over a secure protocol including SSL certificates, if available.
|
URI |
getURI()
Return the URI of the request (including a query string if any,
but only if it is well-formed for a URI representation).
|
protected abstract MultiValueMap<String,HttpCookie> |
initCookies()
Obtain the cookies from the underlying "native" request and adapt those to
an
HttpCookie map. |
protected String |
initId()
Obtain the request id to use, or
null in which case the Object
identity of this request instance is used. |
protected MultiValueMap<String,String> |
initQueryParams()
A method for parsing of the query into name-value pairs.
|
protected abstract SslInfo |
initSslInfo()
Obtain SSL session information from the underlying "native" request.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLocalAddress, getRemoteAddress, mutategetMethod, getMethodValuegetBodypublic AbstractServerHttpRequest(URI uri, @Nullable String contextPath, MultiValueMap<String,String> headers)
uri - the URI for the requestcontextPath - the context path for the requestheaders - the headers for the request (as MultiValueMap)public AbstractServerHttpRequest(URI uri, @Nullable String contextPath, HttpHeaders headers)
uri - the URI for the requestcontextPath - the context path for the requestheaders - the headers for the request (as HttpHeaders)public String getId()
ServerHttpRequestgetId in interface ServerHttpRequestServerWebExchange.getLogPrefix()@Nullable protected String initId()
null in which case the Object
identity of this request instance is used.public URI getURI()
HttpRequestgetURI in interface HttpRequestnull)public RequestPath getPath()
ServerHttpRequestquery.
The returned path is sub-divided into a
RequestPath.contextPath() portion and the remaining
pathWithinApplication portion.
The latter can be passed into methods of
PathPattern for path
matching purposes.
getPath in interface ServerHttpRequestpublic HttpHeaders getHeaders()
HttpMessagegetHeaders in interface HttpMessagenull)public MultiValueMap<String,String> getQueryParams()
ServerHttpRequestgetQueryParams in interface ServerHttpRequestprotected MultiValueMap<String,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.
public MultiValueMap<String,HttpCookie> getCookies()
ServerHttpRequestgetCookies in interface ServerHttpRequestprotected abstract MultiValueMap<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.
@Nullable public SslInfo getSslInfo()
ServerHttpRequestgetSslInfo in interface ServerHttpRequestnull if none available@Nullable protected abstract SslInfo initSslInfo()
null if none availablepublic abstract <T> T getNativeRequest()
Note: This is exposed mainly for internal framework use such as WebSocket upgrades in the spring-webflux module.