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
ConstructorDescriptionHeaders()
Constructs aHeaders
object that is case-insensitive for header names. -
Method Summary
Modifier and TypeMethodDescriptionvoid
A script compatible add method that will accept aHeader
,String
,Collection<String>
andString[]
value.void
An add method to add a particularHeader
instance.void
A script compatible addAll method that will accept aHeader
,String
,Collection<String>
andString[]
value.TheHeaders
class extendsMap<String, Object>
to support flexible parameters in scripting.void
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) Returns a copy of these headers as a multi-valued map of strings.entrySet()
<H extends Header>
HReturns the specifiedHeader
or {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.boolean
isEmpty()
keySet()
A script compatible put method that will accept aHeader
,String
,Collection<String>
andString[]
value.A put method to add a particularHeader
instance.void
A script compatible putAll method that will acceptHeader
,String
,Collection<String>
andString[]
values.Rich-type friendly remove method.int
size()
values()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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 aHeaders
object 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 specifiedHeader
or {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 theHeader
object for the given header name. -
put
A put method to add a particularHeader
instance. Will overwrite any existing value for this header name.- Parameters:
header
- The header instance.- Returns:
- The previous
Header
value for the header with the same name, or null.
-
add
An add method to add a particularHeader
instance. 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:
containsKey
in interfaceMap<String,
Object>
-
containsValue
- Specified by:
containsValue
in interfaceMap<String,
Object>
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
asMapOfHeaders
TheHeaders
class 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
Header
objects.
-
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.
-