Package com.atlan.net
Class HttpHeaders
java.lang.Object
com.atlan.net.HttpHeaders
A read-only view of a set of HTTP headers.
This class mimics the java.net.http.HttpHeaders
added in Java 11.
-
Method Summary
Modifier and TypeMethodDescriptionReturns an unmodifiable List of all of the header string values of the given named header.protected boolean
boolean
firstValue
(String name) Returns anOptional
containing the first header string value of the given named (and possibly multi-valued) header.int
hashCode()
map()
Returns an unmodifiable Map view of this HttpHeaders.static HttpHeaders
Returns anHttpHeaders
instance initialized from the given map.toString()
Returns thisHttpHeaders
as a string.withAdditionalHeader
(String name, String value) Returns a newHttpHeaders
instance containing the headers of the current instance plus the provided header.withAdditionalHeader
(String name, List<String> values) Returns a newHttpHeaders
instance containing the headers of the current instance plus the provided header.withAdditionalHeaders
(Map<String, List<String>> headerMap) Returns a newHttpHeaders
instance containing the headers of the current instance plus the provided headers.
-
Method Details
-
of
Returns anHttpHeaders
instance initialized from the given map.- Parameters:
headerMap
- the map containing the header names and values- Returns:
- an
HttpHeaders
instance containing the given headers - Throws:
NullPointerException
- ifheaderMap
isnull
-
withAdditionalHeader
Returns a newHttpHeaders
instance containing the headers of the current instance plus the provided header.- Parameters:
name
- the name of the header to addvalue
- the value of the header to add- Returns:
- the new
HttpHeaders
instance - Throws:
NullPointerException
- ifname
orvalue
isnull
-
withAdditionalHeader
Returns a newHttpHeaders
instance containing the headers of the current instance plus the provided header.- Parameters:
name
- the name of the header to addvalues
- the values of the header to add- Returns:
- the new
HttpHeaders
instance - Throws:
NullPointerException
- ifname
orvalues
isnull
-
withAdditionalHeaders
Returns a newHttpHeaders
instance containing the headers of the current instance plus the provided headers.- Parameters:
headerMap
- the map containing the headers to add- Returns:
- the new
HttpHeaders
instance - Throws:
NullPointerException
- ifheaderMap
isnull
-
allValues
Returns an unmodifiable List of all of the header string 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 headers string values
-
firstValue
Returns anOptional
containing the first header string value of the given named (and possibly multi-valued) header. If the header is not present, then the returnedOptional
is empty.- Parameters:
name
- the header name- Returns:
- an
Optional<String>
containing the first named header string value, if present
-
map
Returns an unmodifiable Map view of this HttpHeaders.- Returns:
- the Map
-
toString
Returns thisHttpHeaders
as a string. -
equals
-
canEqual
-
hashCode
public int hashCode()
-