Class ServerRequestWrapper.HeadersWrapper
- java.lang.Object
- org.springframework.web.reactive.function.server.support.ServerRequestWrapper.HeadersWrapper
- All Implemented Interfaces:
ServerRequest.Headers
- Enclosing class:
- ServerRequestWrapper
public static class ServerRequestWrapper.HeadersWrapper extends Object implements ServerRequest.Headers
Implementation of theHeaders
interface that can be subclassed to adapt the headers in ahandler filter function
. All methods default to calling through to the wrapped headers.
Constructor Summary
Constructors Constructor Description HeadersWrapper(ServerRequest.Headers headers)
Create a newHeadersWrapper
that wraps the given request.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MediaType>
accept()
Get the list of acceptable media types, as specified by theAccept
header.List<Charset>
acceptCharset()
Get the list of acceptable charsets, as specified by theAccept-Charset
header.List<Locale.LanguageRange>
acceptLanguage()
Get the list of acceptable languages, as specified by theAccept-Language
header.HttpHeaders
asHttpHeaders()
Get the headers as an instance ofHttpHeaders
.OptionalLong
contentLength()
Get the length of the body in bytes, as specified by theContent-Length
header.Optional<MediaType>
contentType()
Get the media type of the body, as specified by theContent-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 theHost
header, if available.List<HttpRange>
range()
Get the value of theRange
header.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.reactive.function.server.ServerRequest.Headers
firstHeader
Constructor Detail
HeadersWrapper
public HeadersWrapper(ServerRequest.Headers headers)
Create a newHeadersWrapper
that wraps the given request.- Parameters:
headers
- the headers to wrap
Method Detail
accept
public List<MediaType> accept()
Description copied from interface:ServerRequest.Headers
Get the list of acceptable media types, as specified by theAccept
header.Returns an empty list if the acceptable media types are unspecified.
- Specified by:
accept
in interfaceServerRequest.Headers
acceptCharset
public List<Charset> acceptCharset()
Description copied from interface:ServerRequest.Headers
Get the list of acceptable charsets, as specified by theAccept-Charset
header.- Specified by:
acceptCharset
in interfaceServerRequest.Headers
acceptLanguage
public List<Locale.LanguageRange> acceptLanguage()
Description copied from interface:ServerRequest.Headers
Get the list of acceptable languages, as specified by theAccept-Language
header.- Specified by:
acceptLanguage
in interfaceServerRequest.Headers
contentLength
public OptionalLong contentLength()
Description copied from interface:ServerRequest.Headers
Get the length of the body in bytes, as specified by theContent-Length
header.- Specified by:
contentLength
in interfaceServerRequest.Headers
contentType
public Optional<MediaType> contentType()
Description copied from interface:ServerRequest.Headers
Get the media type of the body, as specified by theContent-Type
header.- Specified by:
contentType
in interfaceServerRequest.Headers
host
public InetSocketAddress host()
Description copied from interface:ServerRequest.Headers
Get the value of theHost
header, if available.If the header value does not contain a port, the port in the returned address will be
0
.- Specified by:
host
in interfaceServerRequest.Headers
range
public List<HttpRange> range()
Description copied from interface:ServerRequest.Headers
Get the value of theRange
header.Returns an empty list when the range is unknown.
- Specified by:
range
in interfaceServerRequest.Headers
header
public List<String> header(String headerName)
Description copied from interface:ServerRequest.Headers
Get the header value(s), if any, for the header with the given name.Returns an empty list if no header values are found.
- Specified by:
header
in interfaceServerRequest.Headers
- Parameters:
headerName
- the header name
asHttpHeaders
public HttpHeaders asHttpHeaders()
Description copied from interface:ServerRequest.Headers
Get the headers as an instance ofHttpHeaders
.- Specified by:
asHttpHeaders
in interfaceServerRequest.Headers