public interface ServerRequest
HandlerFunction.
 Access to headers and body is offered by ServerRequest.Headers and
 body(Class), respectively.| Modifier and Type | Interface and Description | 
|---|---|
| static interface  | ServerRequest.BuilderDefines a builder for a request. | 
| static interface  | ServerRequest.HeadersRepresents the headers of the HTTP request. | 
| Modifier and Type | Method and Description | 
|---|---|
| default Optional<Object> | attribute(String name)Get the request attribute value if present. | 
| Map<String,Object> | attributes()Get a mutable map of request attributes. | 
| <T> T | body(Class<T> bodyType)Extract the body as an object of the given type. | 
| <T> T | body(ParameterizedTypeReference<T> bodyType)Extract the body as an object of the given type. | 
| MultiValueMap<String,Cookie> | cookies()Get the cookies of this request. | 
| static ServerRequest | create(HttpServletRequest servletRequest,
      List<HttpMessageConverter<?>> messageReaders)Create a new  ServerRequestbased on the givenHttpServletRequestand
 message converters. | 
| static ServerRequest.Builder | from(ServerRequest other)Create a builder with the status, headers, and cookies of the given request. | 
| ServerRequest.Headers | headers()Get the headers of this request. | 
| List<HttpMessageConverter<?>> | messageConverters()Get the readers used to convert the body of this request. | 
| default HttpMethod | method()Get the HTTP method. | 
| String | methodName()Get the name of the HTTP method. | 
| default Optional<String> | param(String name)Get the first parameter with the given name, if present. | 
| MultiValueMap<String,String> | params()Get all parameters for this request. | 
| default String | path()Get the request path. | 
| default PathContainer | pathContainer()Get the request path as a  PathContainer. | 
| default String | pathVariable(String name)Get the path variable with the given name, if present. | 
| Map<String,String> | pathVariables()Get all path variables for this request. | 
| Optional<Principal> | principal()Get the authenticated user for the request, if any. | 
| Optional<InetSocketAddress> | remoteAddress()Get the remote address to which this request is connected, if available. | 
| HttpServletRequest | servletRequest()Get the servlet request that this request is based on. | 
| HttpSession | session()Get the web session for this request. | 
| URI | uri()Get the request URI. | 
| UriBuilder | uriBuilder()Get a  UriBuilderComponentsfrom the URI associated with thisServerRequest. | 
@Nullable default HttpMethod method()
null
 if not resolvable (e.g. in case of a non-standard HTTP method)String methodName()
URI uri()
UriBuilder uriBuilder()
UriBuilderComponents from the URI associated with this
 ServerRequest.default String path()
default PathContainer pathContainer()
PathContainer.ServerRequest.Headers headers()
MultiValueMap<String,Cookie> cookies()
Optional<InetSocketAddress> remoteAddress()
List<HttpMessageConverter<?>> messageConverters()
<T> T body(Class<T> bodyType) throws ServletException, IOException
T - the body typebodyType - the type of return valueServletExceptionIOException<T> T body(ParameterizedTypeReference<T> bodyType) throws ServletException, IOException
T - the body typebodyType - the type of return valueServletExceptionIOExceptiondefault Optional<Object> attribute(String name)
name - the attribute nameMap<String,Object> attributes()
default Optional<String> param(String name)
name - the parameter nameServletRequest.getParameter(String)MultiValueMap<String,String> params()
ServletRequest.getParameterMap()default String pathVariable(String name)
name - the variable nameIllegalArgumentException - if there is no path variable with the given nameHttpSession session()
HttpServletRequest servletRequest()
static ServerRequest create(HttpServletRequest servletRequest, List<HttpMessageConverter<?>> messageReaders)
ServerRequest based on the given HttpServletRequest and
 message converters.servletRequest - the requestmessageReaders - the message readersServerRequeststatic ServerRequest.Builder from(ServerRequest other)
other - the response to copy the status, headers, and cookies from