Class DefaultRequestHeaderContainer
java.lang.Object
com.sap.cloud.sdk.cloudplatform.requestheader.DefaultRequestHeaderContainer
- All Implemented Interfaces:
RequestHeaderContainer
Default implementation of the
RequestHeaderContainer
interface.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Implementation of theRequestHeaderContainer.Builder
interface that is able to construct and manipulateDefaultRequestHeaderContainer
s. -
Field Summary
Fields inherited from interface com.sap.cloud.sdk.cloudplatform.requestheader.RequestHeaderContainer
EMPTY
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Initializes a new instance ofDefaultRequestHeaderContainer.Builder
to construct a newDefaultRequestHeaderContainer
from scratch.boolean
containsHeader
(String headerName) Determines whether an HTTP header with the givenheaderName
exists in this container.boolean
static RequestHeaderContainer
fromMultiValueMap
(Map<String, ? extends Iterable<String>> headers) Initializes a new instance of theDefaultRequestHeaderContainer
class from the givenheaders
.static RequestHeaderContainer
fromSingleValueMap
(Map<String, String> headers) Initializes a new instance of theDefaultRequestHeaderContainer
class from the givenheaders
.Returns all unique names of the contained HTTP headers.getHeaderValues
(String headerName) Returns a non-unique collection of individual values for an HTTP header with the givenheaderName
.int
hashCode()
Initializes a new instance ofRequestHeaderContainer.Builder
by copying all HTTP headers that are contained in thisRequestHeaderContainer
.toString()
-
Method Details
-
fromSingleValueMap
@Nonnull public static RequestHeaderContainer fromSingleValueMap(@Nonnull Map<String, String> headers) Initializes a new instance of theDefaultRequestHeaderContainer
class from the givenheaders
.- Parameters:
headers
- AMap
ofString
(HTTP header name) toString
(HTTP header value). Please note that headers with empty or null values are skipped.- Returns:
- A new instance of
RequestHeaderContainer
.
-
fromMultiValueMap
@Nonnull public static RequestHeaderContainer fromMultiValueMap(@Nonnull Map<String, ? extends Iterable<String>> headers) Initializes a new instance of theDefaultRequestHeaderContainer
class from the givenheaders
.- Parameters:
headers
- AMap
ofString
(HTTP header name) toIterable
(HTTP header values). Please note that headers with empty or null values are skipped.- Returns:
- A new instance of
RequestHeaderContainer
.
-
getHeaderNames
Description copied from interface:RequestHeaderContainer
Returns all unique names of the contained HTTP headers.Important: Casing of the individual names might be changed by the implementation. Duplicated names that differ only in their casing will be treated as a single name.
Example: The header names
HeaderA
,HEADERA
, andheadera
will result in only a single value being returned from this method.Note: Do not assume any specific casing of the returned header names. Also, do not use this method for determining whether a specific header is contained in this collection. Use
RequestHeaderContainer.containsHeader(String)
instead.- Specified by:
getHeaderNames
in interfaceRequestHeaderContainer
- Returns:
- An immutable
List
of contained HTTP header names.
-
containsHeader
Description copied from interface:RequestHeaderContainer
Determines whether an HTTP header with the givenheaderName
exists in this container. TheheaderName
is treated case insensitively.- Specified by:
containsHeader
in interfaceRequestHeaderContainer
- Parameters:
headerName
- The name of the HTTP header to look for.- Returns:
true
if an HTTP header with the given name is contained,false
otherwise.
-
getHeaderValues
Description copied from interface:RequestHeaderContainer
Returns a non-unique collection of individual values for an HTTP header with the givenheaderName
. TheheaderName
is treated case insensitively.- Specified by:
getHeaderValues
in interfaceRequestHeaderContainer
- Parameters:
headerName
- The name of the HTTP header to retrieve the values for.- Returns:
- An immutable
List
of individual HTTP header values.
-
toBuilder
Description copied from interface:RequestHeaderContainer
Initializes a new instance ofRequestHeaderContainer.Builder
by copying all HTTP headers that are contained in thisRequestHeaderContainer
.- Specified by:
toBuilder
in interfaceRequestHeaderContainer
- Returns:
- A new instance of
RequestHeaderContainer.Builder
.
-
builder
Initializes a new instance ofDefaultRequestHeaderContainer.Builder
to construct a newDefaultRequestHeaderContainer
from scratch.- Returns:
- A new instance of
DefaultRequestHeaderContainer.Builder
.
-
toString
-
equals
-
hashCode
public int hashCode()
-