-
public interface HttpHeadersA read-only view of a set of HTTP headers.
Incubating Feature. Will be removed in a future release.- Since:
- 9
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<String>allValues(String name)Returns an unmodifiable List of all of the values of the given named header.Optional<String>firstValue(String name)Returns anOptionalcontaining the first value of the given named (and possibly multi-valued) header.OptionalLongfirstValueAsLong(String name)Returns anOptionalLongcontaining the first value of the named header field.Map<String,List<String>>map()Returns an unmodifiable multi Map view of this HttpHeaders.
-
-
-
Method Detail
-
firstValue
Optional<String> firstValue(String name)
Returns anOptionalcontaining the first value of the given named (and possibly multi-valued) header. If the header is not present, then the returnedOptionalis empty.- Parameters:
name- the header name- Returns:
- an
Optional<String>for the first named value
-
firstValueAsLong
OptionalLong firstValueAsLong(String name)
Returns anOptionalLongcontaining the first value of the named header field. If the header is not present, then the Optional is empty. If the header is present but contains a value that does not parse as aLongvalue, then an exception is thrown.- Parameters:
name- the header name- Returns:
- an
OptionalLong - Throws:
NumberFormatException- if a value is found, but does not parse as a Long
-
allValues
List<String> allValues(String name)
Returns an unmodifiable List of all of the values of the given named header. Always returns a List, which may be empty if the header is not present.- Parameters:
name- the header name- Returns:
- a List of String values
-
-