public class RequestWrapper extends Object implements Request
Request
interface that can be subclassed to adapt the request to a
handler function
. All methods default to calling through to the wrapped request.Modifier and Type | Class and Description |
---|---|
static class |
RequestWrapper.HeadersWrapper
Implementation of the
Headers interface that can be subclassed to adapt the headers to a
handler function . |
Request.Headers
Constructor and Description |
---|
RequestWrapper(Request request)
Create a new
RequestWrapper that wraps the given request. |
Modifier and Type | Method and Description |
---|---|
<T> Optional<T> |
attribute(String name)
Return the request attribute value if present.
|
<T> T |
body(BodyExtractor<T> extractor)
Extract the body with the given
BodyExtractor . |
Request.Headers |
headers()
Return the headers of this request.
|
HttpMethod |
method()
Return the HTTP method.
|
String |
path()
Return the request path.
|
Optional<String> |
pathVariable(String name)
Return the path variable with the given name, if present.
|
Map<String,String> |
pathVariables()
Return all path variables.
|
Optional<String> |
queryParam(String name)
Return the first query parameter with the given name, if present.
|
List<String> |
queryParams(String name)
Return all query parameter with the given name.
|
Request |
request()
Return the wrapped request.
|
URI |
uri()
Return the request URI.
|
public RequestWrapper(Request request)
RequestWrapper
that wraps the given request.request
- the request to wrappublic Request request()
public HttpMethod method()
Request
public Request.Headers headers()
Request
public <T> T body(BodyExtractor<T> extractor)
Request
BodyExtractor
.public <T> Optional<T> attribute(String name)
Request
public Optional<String> queryParam(String name)
Request
queryParam
in interface Request
name
- the parameter namepublic List<String> queryParams(String name)
Request
queryParams
in interface Request
name
- the parameter namepublic Optional<String> pathVariable(String name)
Request
pathVariable
in interface Request
name
- the variable name