Package org.springframework.http.support
Class HttpComponentsHeadersAdapter
java.lang.Object
org.springframework.http.support.HttpComponentsHeadersAdapter
public final class HttpComponentsHeadersAdapter
extends Object
implements MultiValueMap<String,String>
MultiValueMap
implementation for wrapping Apache HttpComponents
HttpClient headers.- Since:
- 6.1
- Author:
- Rossen Stoyanchev, Simon Baslé
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionHttpComponentsHeadersAdapter
(org.apache.hc.core5.http.HttpMessage message) Create a newHttpComponentsHeadersAdapter
based on the givenHttpMessage
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the given single value to the current list of values for the given key.void
Add all the values of the given list to the current list of values for the given key.void
addAll
(MultiValueMap<String, String> values) Add all the values of the givenMultiValueMap
to the current values.void
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
Return the first value for the given key.boolean
isEmpty()
keySet()
void
void
Set the given single value under the given key.void
Set the given values under.int
size()
Return aMap
with the first values contained in thisMultiValueMap
.toString()
values()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
Methods inherited from interface org.springframework.util.MultiValueMap
addIfAbsent, asSingleValueMap
-
Constructor Details
-
HttpComponentsHeadersAdapter
public HttpComponentsHeadersAdapter(org.apache.hc.core5.http.HttpMessage message) Create a newHttpComponentsHeadersAdapter
based on the givenHttpMessage
.
-
-
Method Details
-
getFirst
Description copied from interface:MultiValueMap
Return the first value for the given key.- Specified by:
getFirst
in interfaceMultiValueMap<String,
String> - Parameters:
key
- the key- Returns:
- the first value for the specified key, or
null
if none
-
add
Description copied from interface:MultiValueMap
Add the given single value to the current list of values for the given key.- Specified by:
add
in interfaceMultiValueMap<String,
String> - Parameters:
key
- the keyvalue
- the value to be added
-
addAll
Description copied from interface:MultiValueMap
Add all the values of the given list to the current list of values for the given key.- Specified by:
addAll
in interfaceMultiValueMap<String,
String> - Parameters:
key
- they keyvalues
- the values to be added
-
addAll
Description copied from interface:MultiValueMap
Add all the values of the givenMultiValueMap
to the current values.- Specified by:
addAll
in interfaceMultiValueMap<String,
String> - Parameters:
values
- the values to be added
-
set
Description copied from interface:MultiValueMap
Set the given single value under the given key.- Specified by:
set
in interfaceMultiValueMap<String,
String> - Parameters:
key
- the keyvalue
- the value to set
-
setAll
Description copied from interface:MultiValueMap
Set the given values under.- Specified by:
setAll
in interfaceMultiValueMap<String,
String> - Parameters:
values
- the values.
-
toSingleValueMap
Description copied from interface:MultiValueMap
Return aMap
with the first values contained in thisMultiValueMap
. The difference between this method andMultiValueMap.asSingleValueMap()
is that this method returns a copy of the entries of this map, whereas the latter returns a view.- Specified by:
toSingleValueMap
in interfaceMultiValueMap<String,
String> - Returns:
- a single value representation of this map
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<String,
List<String>>
-
containsValue
- Specified by:
containsValue
in interfaceMap<String,
List<String>>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
toString
-