Package com.atlassian.bamboo.web
Class HttpHeaders
java.lang.Object
com.atlassian.bamboo.web.HttpHeaders
- All Implemented Interfaces:
Serializable,Map<String,,List<String>> org.springframework.util.MultiValueMap<String,String>
public class HttpHeaders
extends Object
implements org.springframework.util.MultiValueMap<String,String>, Serializable
Represents HTTP request and response headers, mapping string header names to a list of string values.
- Since:
- 10.0
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new, empty instance of theHttpHeadersobject.HttpHeaders(org.springframework.util.MultiValueMap<String, String> headers) Construct a newHttpHeadersinstance backed by an existing map. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the given, single header value under the given name.voidvoidvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanstatic StringformatHeaders(org.springframework.util.MultiValueMap<String, String> headers) Helps to format HTTP header values, as HTTP header values themselves can contain comma-separated values, can become confusing with regularMapformatting that also uses commas between entries.@Nullable StringReturn the first header value for the given header name, if any.getOrEmpty(Object headerName) Get the list of header values for the given header name, if any.inthashCode()booleanisEmpty()keySet()voidvoidSet the given, single header value under the given name.voidintsize()toString()@NotNull Collection<List<String>>values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllMethods inherited from interface org.springframework.util.MultiValueMap
addIfAbsent
-
Constructor Details
-
HttpHeaders
public HttpHeaders()Construct a new, empty instance of theHttpHeadersobject.This is the common constructor, using a case-insensitive map structure.
-
HttpHeaders
Construct a newHttpHeadersinstance backed by an existing map.This constructor is available as an optimization for adapting to existing headers map structures, primarily for internal use within the framework.
- Parameters:
headers- the headers map (expected to operate with case-insensitive keys)
-
-
Method Details
-
getOrEmpty
Get the list of header values for the given header name, if any.- Parameters:
headerName- the header name- Returns:
- the list of header values, or an empty list
-
getFirst
Return the first header value for the given header name, if any. -
add
Add the given, single header value under the given name.- Specified by:
addin interfaceorg.springframework.util.MultiValueMap<String,String> - Parameters:
headerName- the header nameheaderValue- the header value- Throws:
UnsupportedOperationException- if adding headers is not supported- See Also:
-
addAll
-
addAll
-
set
Set the given, single header value under the given name.- Specified by:
setin interfaceorg.springframework.util.MultiValueMap<String,String> - Parameters:
headerName- the header nameheaderValue- the header value- Throws:
UnsupportedOperationException- if adding headers is not supported- See Also:
-
setAll
-
toSingleValueMap
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<String,List<String>>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,List<String>>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
equals
-
hashCode
public int hashCode() -
toString
-
formatHeaders
Helps to format HTTP header values, as HTTP header values themselves can contain comma-separated values, can become confusing with regularMapformatting that also uses commas between entries.- Parameters:
headers- the headers to format- Returns:
- the headers to a String
-