Package org.forgerock.http.protocol
Class Headers
java.lang.Object
org.forgerock.http.protocol.Headers
Message headers, a case-insensitive multiple-value map.
- 
Nested Class Summary
 - 
Constructor Summary
ConstructorsConstructorDescriptionHeaders()Constructs aHeadersobject that is case-insensitive for header names. - 
Method Summary
Modifier and TypeMethodDescriptionvoidA script compatible add method that will accept aHeader,String,Collection<String>andString[]value.voidAn add method to add a particularHeaderinstance.voidA script compatible addAll method that will accept aHeader,String,Collection<String>andString[]value.TheHeadersclass extendsMap<String, Object>to support flexible parameters in scripting.voidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) Returns a copy of these headers as a multi-valued map of strings.entrySet()<H extends Header>
HReturns the specifiedHeaderor {code null} if the header is not included in the message.Rich-type friendly get method.Gets all the values of the header, or an empty list if the header doesn't exist.Gets the first value of the header, or null if the header does not exist.Gets the first value of the header, or null if the header does not exist.booleanisEmpty()keySet()A script compatible put method that will accept aHeader,String,Collection<String>andString[]value.A put method to add a particularHeaderinstance.voidA script compatible putAll method that will acceptHeader,String,Collection<String>andString[]values.Rich-type friendly remove method.intsize()values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll 
- 
Constructor Details
- 
Headers
public Headers()Constructs aHeadersobject that is case-insensitive for header names. 
 - 
 - 
Method Details
- 
get
Rich-type friendly get method. - 
getFirst
Gets the first value of the header, or null if the header does not exist.- Parameters:
 key- The name of the header.- Returns:
 - The first header value.
 
 - 
getFirst
Gets the first value of the header, or null if the header does not exist.- Parameters:
 key- The name of the header.- Returns:
 - The first header value.
 
 - 
getAll
Gets all the values of the header, or an empty list if the header doesn't exist.- Parameters:
 key- The name of the header.- Returns:
 - The values of the header.
 
 - 
get
Returns the specifiedHeaderor {code null} if the header is not included in the message.- Type Parameters:
 H- The type of header.- Parameters:
 headerType- The type of header.- Returns:
 - The header instance, or null if none exists.
 - Throws:
 MalformedHeaderException- When the header was not well formed, and so could not be parsed as its richly-typed class.
 - 
putAll
A script compatible putAll method that will acceptHeader,String,Collection<String>andString[]values. - 
put
A script compatible put method that will accept aHeader,String,Collection<String>andString[]value. - 
remove
Rich-type friendly remove method. Removes theHeaderobject for the given header name. - 
put
A put method to add a particularHeaderinstance. Will overwrite any existing value for this header name.- Parameters:
 header- The header instance.- Returns:
 - The previous 
Headervalue for the header with the same name, or null. 
 - 
add
An add method to add a particularHeaderinstance. Existing values for the header will be added to.- Parameters:
 header- The header instance.
 - 
add
A script compatible add method that will accept aHeader,String,Collection<String>andString[]value. Existing values for the header will be added to.- Parameters:
 key- The name of the header.value- AHeader,String,Collection<String>orString[].
 - 
addAll
A script compatible addAll method that will accept aHeader,String,Collection<String>andString[]value. Existing values for the headers will be added to.- Parameters:
 map- A map of header names to values.
 - 
size
public int size() - 
isEmpty
public boolean isEmpty() - 
containsKey
- Specified by:
 containsKeyin interfaceMap<String,Object> 
 - 
containsValue
- Specified by:
 containsValuein interfaceMap<String,Object> 
 - 
clear
public void clear() - 
keySet
 - 
values
 - 
entrySet
 - 
asMapOfHeaders
TheHeadersclass extendsMap<String, Object>to support flexible parameters in scripting. This method allows access to the underlyingMap<String, Header>.- Returns:
 - The map of header names to 
Headerobjects. 
 - 
copyAsMultiMapOfStrings
Returns a copy of these headers as a multi-valued map of strings. Changes to the returned map will not be reflected in these headers, nor will changes in these headers be reflected in the returned map.- Returns:
 - a copy of these headers as a multi-valued map of strings.
 
 
 -