public static class RequestWrapper.HeadersWrapper extends Object implements Request.Headers
Headers interface that can be subclassed to adapt the headers to a
handler function. All methods default to calling through to the wrapped headers.| Constructor and Description |
|---|
HeadersWrapper(Request.Headers headers)
Create a new
HeadersWrapper that wraps the given request. |
| Modifier and Type | Method and Description |
|---|---|
List<org.springframework.http.MediaType> |
accept()
Return the list of acceptable media types,
as specified by the
Accept header. |
List<Charset> |
acceptCharset()
Return the list of acceptable charsets,
as specified by the
Accept-Charset header. |
org.springframework.http.HttpHeaders |
asHttpHeaders()
Return the headers as a
HttpHeaders instance. |
OptionalLong |
contentLength()
Return the length of the body in bytes, as specified by the
Content-Length header. |
Optional<org.springframework.http.MediaType> |
contentType()
Return the media type of the body, as specified
by the
Content-Type header. |
List<String> |
header(String headerName)
Return the header value(s), if any, for the header of the given name.
|
InetSocketAddress |
host()
Return the value of the required
Host header. |
List<org.springframework.http.HttpRange> |
range()
Return the value of the
Range header. |
public HeadersWrapper(Request.Headers headers)
HeadersWrapper that wraps the given request.headers - the headers to wrappublic List<org.springframework.http.MediaType> accept()
Request.HeadersAccept header.
Returns an empty list when the acceptable media types are unspecified.
accept in interface Request.Headerspublic List<Charset> acceptCharset()
Request.HeadersAccept-Charset header.acceptCharset in interface Request.Headerspublic OptionalLong contentLength()
Request.HeadersContent-Length header.contentLength in interface Request.Headerspublic Optional<org.springframework.http.MediaType> contentType()
Request.HeadersContent-Type header.contentType in interface Request.Headerspublic InetSocketAddress host()
Request.HeadersHost header.
If the header value does not contain a port, the returned
port will be 0.
host in interface Request.Headerspublic List<org.springframework.http.HttpRange> range()
Request.HeadersRange header.
Returns an empty list when the range is unknown.
range in interface Request.Headerspublic List<String> header(String headerName)
Request.HeadersReturn an empty list if no header values are found.
header in interface Request.HeadersheaderName - the header namepublic org.springframework.http.HttpHeaders asHttpHeaders()
Request.HeadersHttpHeaders instance.asHttpHeaders in interface Request.Headers