Interface ServerRequest.Headers
- Enclosing interface:
- ServerRequest
public static interface ServerRequest.Headers
Represents the headers of the HTTP request.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionList<org.springframework.http.MediaType>accept()Get the list of acceptable media types, as specified by theAcceptheader.Get the list of acceptable charsets, as specified by theAccept-Charsetheader.Get the list of acceptable languages, as specified by theAccept-Languageheader.org.springframework.http.HttpHeadersGet the headers as an instance ofHttpHeaders.Get the length of the body in bytes, as specified by theContent-Lengthheader.Optional<org.springframework.http.MediaType>Get the media type of the body, as specified by theContent-Typeheader.default StringfirstHeader(String headerName) Get the first header value, if any, for the header for the given name.Get the header value(s), if any, for the header of the given name.host()Get the value of theHostheader, if available.List<org.springframework.http.HttpRange>range()Get the value of theRangeheader.
-
Method Details
-
accept
List<org.springframework.http.MediaType> accept()Get the list of acceptable media types, as specified by theAcceptheader.Returns an empty list if the acceptable media types are unspecified.
-
acceptCharset
Get the list of acceptable charsets, as specified by theAccept-Charsetheader. -
acceptLanguage
List<Locale.LanguageRange> acceptLanguage()Get the list of acceptable languages, as specified by theAccept-Languageheader. -
contentLength
OptionalLong contentLength()Get the length of the body in bytes, as specified by theContent-Lengthheader. -
contentType
Optional<org.springframework.http.MediaType> contentType()Get the media type of the body, as specified by theContent-Typeheader. -
host
Get the value of theHostheader, if available.If the header value does not contain a port, the port in the returned address will be
0. -
range
List<org.springframework.http.HttpRange> range()Get the value of theRangeheader.Returns an empty list when the range is unknown.
-
header
Get the header value(s), if any, for the header of the given name.Returns an empty list if no header values are found.
- Parameters:
headerName- the header name
-
firstHeader
Get the first header value, if any, for the header for the given name.Returns
nullif no header values are found.- Parameters:
headerName- the header name- Since:
- 5.2.5
-
asHttpHeaders
org.springframework.http.HttpHeaders asHttpHeaders()Get the headers as an instance ofHttpHeaders.
-