Class HttpHeaders
- java.lang.Object
-
- com.github.nosan.embedded.cassandra.commons.web.HttpHeaders
-
-
Constructor Summary
Constructors Constructor Description HttpHeaders()Creates a new emptyHttpHeadersinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String name, String value)Adds a value to the list of values for the specified header name.voidclear()booleancontainsKey(Object name)booleancontainsValue(Object value)static HttpHeaderscopyOf(Map<String,List<String>> headers)Creates anHttpHeadersinstance by copying the provided headers.Set<Map.Entry<String,List<String>>>entrySet()booleanequals(Object o)List<String>get(Object name)Optional<String>getFirst(String name)Retrieves the first value associated with the given header name.inthashCode()booleanisEmpty()Set<String>keySet()List<String>put(String name, List<String> values)voidputAll(Map<? extends String,? extends List<String>> headers)static HttpHeadersreadOnly(Map<String,List<String>> headers)Creates a read-only view of the specified HTTP headers.List<String>remove(Object name)voidset(String name, String value)Sets a single value for the specified header name.intsize()StringtoString()Collection<List<String>>values()-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
HttpHeaders
public HttpHeaders()
Creates a new emptyHttpHeadersinstance.
-
-
Method Detail
-
readOnly
public static HttpHeaders readOnly(Map<String,List<String>> headers)
Creates a read-only view of the specified HTTP headers.- Parameters:
headers- The headers to create a read-only view for- Returns:
- A read-only
HttpHeadersinstance
-
copyOf
public static HttpHeaders copyOf(Map<String,List<String>> headers)
Creates anHttpHeadersinstance by copying the provided headers.- Parameters:
headers- The headers to copy- Returns:
- A new
HttpHeadersinstance - Throws:
NullPointerException- Ifheadersisnull
-
containsKey
public boolean containsKey(Object name)
- Specified by:
containsKeyin interfaceMap<String,List<String>>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<String,List<String>>
-
getFirst
public Optional<String> getFirst(String name)
Retrieves the first value associated with the given header name.- Parameters:
name- The header name- Returns:
- An
Optionalcontaining the first header value, orOptional.empty()if no value exists
-
add
public void add(String name, String value)
Adds a value to the list of values for the specified header name. If the header does not already exist, it will be created.- Parameters:
name- The header namevalue- The header value to add
-
set
public void set(String name, String value)
Sets a single value for the specified header name. This replaces any existing values for the header.- Parameters:
name- The header namevalue- The header value to set
-
values
public Collection<List<String>> values()
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
-