public static class ServerRequestWrapper.HeadersWrapper extends Object implements ServerRequest.Headers
Headers interface that can be subclassed
to adapt the headers in a
handler filter function.
All methods default to calling through to the wrapped headers.| Constructor and Description |
|---|
HeadersWrapper(ServerRequest.Headers headers)
Create a new
HeadersWrapper that wraps the given request. |
| Modifier and Type | Method and Description |
|---|---|
List<MediaType> |
accept()
Get the list of acceptable media types, as specified by the
Accept
header. |
List<Charset> |
acceptCharset()
Get the list of acceptable charsets, as specified by the
Accept-Charset header. |
List<Locale.LanguageRange> |
acceptLanguage()
Get the list of acceptable languages, as specified by the
Accept-Language header. |
HttpHeaders |
asHttpHeaders()
Get the headers as an instance of
HttpHeaders. |
OptionalLong |
contentLength()
Get the length of the body in bytes, as specified by the
Content-Length header. |
Optional<MediaType> |
contentType()
Get the media type of the body, as specified by the
Content-Type header. |
List<String> |
header(String headerName)
Get the header value(s), if any, for the header with the given name.
|
InetSocketAddress |
host()
Get the value of the
Host header, if available. |
List<HttpRange> |
range()
Get the value of the
Range header. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfirstHeaderpublic HeadersWrapper(ServerRequest.Headers headers)
HeadersWrapper that wraps the given request.headers - the headers to wrappublic List<MediaType> accept()
ServerRequest.HeadersAccept
header.
Returns an empty list if the acceptable media types are unspecified.
accept in interface ServerRequest.Headerspublic List<Charset> acceptCharset()
ServerRequest.HeadersAccept-Charset header.acceptCharset in interface ServerRequest.Headerspublic List<Locale.LanguageRange> acceptLanguage()
ServerRequest.HeadersAccept-Language header.acceptLanguage in interface ServerRequest.Headerspublic OptionalLong contentLength()
ServerRequest.HeadersContent-Length header.contentLength in interface ServerRequest.Headerspublic Optional<MediaType> contentType()
ServerRequest.HeadersContent-Type header.contentType in interface ServerRequest.Headerspublic InetSocketAddress host()
ServerRequest.HeadersHost header, if available.
If the header value does not contain a port, the
port in the returned address will
be 0.
host in interface ServerRequest.Headerspublic List<HttpRange> range()
ServerRequest.HeadersRange header.
Returns an empty list when the range is unknown.
range in interface ServerRequest.Headerspublic List<String> header(String headerName)
ServerRequest.HeadersReturns an empty list if no header values are found.
header in interface ServerRequest.HeadersheaderName - the header namepublic HttpHeaders asHttpHeaders()
ServerRequest.HeadersHttpHeaders.asHttpHeaders in interface ServerRequest.Headers