Class AbstractServerHttpRequest
java.lang.Object
org.springframework.http.server.reactive.AbstractServerHttpRequest
- All Implemented Interfaces:
HttpMessage,HttpRequest,ReactiveHttpInputMessage,ServerHttpRequest
- Direct Known Subclasses:
MockServerHttpRequest
Common base class for
ServerHttpRequest implementations.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.http.server.reactive.ServerHttpRequest
ServerHttpRequest.Builder -
Constructor Summary
ConstructorsConstructorDescriptionAbstractServerHttpRequest(URI uri, String contextPath, HttpHeaders headers) Deprecated, for removal: This API element is subject to removal in a future version.AbstractServerHttpRequest(URI uri, String contextPath, MultiValueMap<String, String> headers) Deprecated, for removal: This API element is subject to removal in a future version.since 6.0.8, in favor ofAbstractServerHttpRequest(HttpMethod, URI, String, MultiValueMap)AbstractServerHttpRequest(HttpMethod method, URI uri, String contextPath, MultiValueMap<String, String> headers) Constructor with the method, URI and headers for the request. -
Method Summary
Modifier and TypeMethodDescriptionReturn a read-only map of cookies sent by the client.Return the headers of this message.getId()Return an id that represents the underlying connection, if available, or the request for the purpose of correlating log messages.Return the HTTP method of the request.abstract <T> TReturn the underlying server response.getPath()Returns a structured representation of the full request path up to but not including thequery.Return a read-only map with parsed and decoded query parameter values.Return the SSL session information if the request has been transmitted over a secure protocol including SSL certificates, if available.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> Obtain the cookies from the underlying "native" request and adapt those to anHttpCookiemap.protected StringinitId()Obtain the request id to use, ornullin which case the Object identity of this request instance is used.protected StringSubclasses can override this to provide the prefix to use for log messages.protected MultiValueMap<String,String> A method for parsing of the query into name-value pairs.protected abstract SslInfoObtain SSL session information from the underlying "native" request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.http.HttpRequest
getMethodValueMethods inherited from interface org.springframework.http.ReactiveHttpInputMessage
getBodyMethods inherited from interface org.springframework.http.server.reactive.ServerHttpRequest
getLocalAddress, getRemoteAddress, mutate
-
Constructor Details
-
AbstractServerHttpRequest
@Deprecated(since="6.0.8", forRemoval=true) public AbstractServerHttpRequest(URI uri, @Nullable String contextPath, MultiValueMap<String, String> headers) Deprecated, for removal: This API element is subject to removal in a future version.since 6.0.8, in favor ofAbstractServerHttpRequest(HttpMethod, URI, String, MultiValueMap)Constructor with the URI and headers for the request.- Parameters:
uri- the URI for the requestcontextPath- the context path for the requestheaders- the headers for the request (asMultiValueMap)- Since:
- 5.3
-
AbstractServerHttpRequest
public AbstractServerHttpRequest(HttpMethod method, URI uri, @Nullable String contextPath, MultiValueMap<String, String> headers) Constructor with the method, URI and headers for the request.- Parameters:
method- the HTTP method for the requesturi- the URI for the requestcontextPath- the context path for the requestheaders- the headers for the request (asMultiValueMap)- Since:
- 6.0.8
-
AbstractServerHttpRequest
@Deprecated(since="6.0.8", forRemoval=true) public AbstractServerHttpRequest(URI uri, @Nullable String contextPath, HttpHeaders headers) Deprecated, for removal: This API element is subject to removal in a future version.since 6.0.8, in favor ofAbstractServerHttpRequest(HttpMethod, URI, String, MultiValueMap)Constructor with the URI and headers for the request.- Parameters:
uri- the URI for the requestcontextPath- the context path for the requestheaders- the headers for the request (asHttpHeaders)
-
-
Method Details
-
getId
Description copied from interface:ServerHttpRequestReturn an id that represents the underlying connection, if available, or the request for the purpose of correlating log messages.- Specified by:
getIdin interfaceServerHttpRequest- See Also:
-
initId
Obtain the request id to use, ornullin which case the Object identity of this request instance is used.- Since:
- 5.1
-
getMethod
Description copied from interface:HttpRequestReturn the HTTP method of the request.- Specified by:
getMethodin interfaceHttpRequest- Returns:
- the HTTP method as an HttpMethod value
- See Also:
-
getURI
Description copied from interface:HttpRequestReturn the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).- Specified by:
getURIin interfaceHttpRequest- Returns:
- the URI of the request (never
null)
-
getPath
Description copied from interface:ServerHttpRequestReturns a structured representation of the full request path up to but not including thequery.The returned path is subdivided into a
RequestPath.contextPath()portion and the remainingpathWithinApplicationportion. The latter can be passed into methods ofPathPatternfor path matching purposes.- Specified by:
getPathin interfaceServerHttpRequest
-
getHeaders
Description copied from interface:HttpMessageReturn the headers of this message.- Specified by:
getHeadersin interfaceHttpMessage- Returns:
- a corresponding HttpHeaders object (never
null)
-
getQueryParams
Description copied from interface:ServerHttpRequestReturn a read-only map with parsed and decoded query parameter values.- Specified by:
getQueryParamsin interfaceServerHttpRequest
-
initQueryParams
A method for parsing of the query into name-value pairs. The return value is turned into an immutable map and cached.Note that this method is invoked lazily on first access to
getQueryParams(). The invocation is not synchronized but the parsing is thread-safe nevertheless. -
getCookies
Description copied from interface:ServerHttpRequestReturn a read-only map of cookies sent by the client.- Specified by:
getCookiesin interfaceServerHttpRequest
-
initCookies
Obtain the cookies from the underlying "native" request and adapt those to anHttpCookiemap. The return value is turned into an immutable map and cached.Note that this method is invoked lazily on access to
getCookies(). Subclasses should synchronize cookie initialization if the underlying "native" request does not provide thread-safe access to cookie data. -
getSslInfo
Description copied from interface:ServerHttpRequestReturn the SSL session information if the request has been transmitted over a secure protocol including SSL certificates, if available.- Specified by:
getSslInfoin interfaceServerHttpRequest- Returns:
- the session information, or
nullif none available
-
initSslInfo
Obtain SSL session information from the underlying "native" request.- Returns:
- the session information, or
nullif none available - Since:
- 5.0.2
-
getNativeRequest
public abstract <T> T getNativeRequest()Return the underlying server response.Note: This is exposed mainly for internal framework use such as WebSocket upgrades in the spring-webflux module.
-
initLogPrefix
Subclasses can override this to provide the prefix to use for log messages.By default, this is
getId().- Since:
- 5.3.15
-
AbstractServerHttpRequest(HttpMethod, URI, String, MultiValueMap)