Class HttpHeadersImpl
- java.lang.Object
-
- jdk.incubator.http.internal.common.HttpHeadersImpl
-
- All Implemented Interfaces:
HttpHeaders
public class HttpHeadersImpl extends java.lang.Object implements HttpHeaders
Implementation of HttpHeaders.
-
-
Constructor Summary
Constructors Constructor Description HttpHeadersImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHeader(java.lang.String name, java.lang.String value)
java.util.List<java.lang.String>
allValues(java.lang.String name)
Returns an unmodifiable List of all of the values of the given named header.void
clear()
HttpHeadersImpl
deepCopy()
java.util.Map<java.lang.String,java.util.List<java.lang.String>>
directMap()
java.util.Optional<java.lang.String>
firstValue(java.lang.String name)
Returns anOptional
containing the first value of the given named (and possibly multi-valued) header.java.util.OptionalLong
firstValueAsLong(java.lang.String name)
Returns anOptionalLong
containing the first value of the named header field.java.util.Map<java.lang.String,java.util.List<java.lang.String>>
map()
Returns an unmodifiable multi Map view of this HttpHeaders.void
setHeader(java.lang.String name, java.lang.String value)
-
-
-
Method Detail
-
firstValue
public java.util.Optional<java.lang.String> firstValue(java.lang.String name)
Description copied from interface:HttpHeaders
Returns anOptional
containing the first value of the given named (and possibly multi-valued) header. If the header is not present, then the returnedOptional
is empty.- Specified by:
firstValue
in interfaceHttpHeaders
- Parameters:
name
- the header name- Returns:
- an
Optional<String>
for the first named value
-
allValues
public java.util.List<java.lang.String> allValues(java.lang.String name)
Description copied from interface:HttpHeaders
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.- Specified by:
allValues
in interfaceHttpHeaders
- Parameters:
name
- the header name- Returns:
- a List of String values
-
map
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> map()
Description copied from interface:HttpHeaders
Returns an unmodifiable multi Map view of this HttpHeaders. This interface should only be used when it is required to iterate over the entire set of headers.- Specified by:
map
in interfaceHttpHeaders
- Returns:
- the Map
-
directMap
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> directMap()
-
deepCopy
public HttpHeadersImpl deepCopy()
-
addHeader
public void addHeader(java.lang.String name, java.lang.String value)
-
setHeader
public void setHeader(java.lang.String name, java.lang.String value)
-
firstValueAsLong
public java.util.OptionalLong firstValueAsLong(java.lang.String name)
Description copied from interface:HttpHeaders
Returns anOptionalLong
containing 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 aLong
value, then an exception is thrown.- Specified by:
firstValueAsLong
in interfaceHttpHeaders
- Parameters:
name
- the header name- Returns:
- an
OptionalLong
-
clear
public void clear()
-
-