Class DefaultRequestHeaderContainer.Builder
java.lang.Object
com.sap.cloud.sdk.cloudplatform.requestheader.DefaultRequestHeaderContainer.Builder
- All Implemented Interfaces:
RequestHeaderContainer.Builder
- Enclosing class:
- DefaultRequestHeaderContainer
@Beta
public static class DefaultRequestHeaderContainer.Builder
extends Object
implements RequestHeaderContainer.Builder
Implementation of the
RequestHeaderContainer.Builder
interface that is able to construct and manipulate
DefaultRequestHeaderContainer
s.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Initializes a new instance ofRequestHeaderContainer
from the HTTP headers and cookies contained in thisRequestHeaderContainer.Builder
.clear()
Removes all HTTP headers and cookies from thisRequestHeaderContainer.Builder
.replaceHeader
(String name, RequestHeaderContainer headerContainer) Replaces an HTTP header in thisRequestHeaderContainer.Builder
by copying the HTTP header of the givenheaderContainer
.replaceHeader
(String name, Iterable<String> values) Replaces an HTTP header in thisRequestHeaderContainer.Builder
.replaceHeader
(String name, String firstValue, String... furtherValues) Replaces an HTTP header in thisRequestHeaderContainer.Builder
.withHeader
(String name, RequestHeaderContainer headerContainer) Copies the HTTP header with the givenname
- including all it's values - from theheaderContainer
.withHeader
(String name, Iterable<String> values) Adds a new HTTP header with the given values to thisRequestHeaderContainer.Builder
.withHeader
(String name, String firstValue, String... furtherValues) Adds a new HTTP header with the given values to thisRequestHeaderContainer.Builder
.withHeaders
(RequestHeaderContainer headerContainer) Copies all existing headers from the givenRequestHeaderContainer
.withoutHeader
(String name) Removes an HTTP header from thisRequestHeaderContainer.Builder
.
-
Method Details
-
withHeaders
@Nonnull public RequestHeaderContainer.Builder withHeaders(@Nonnull RequestHeaderContainer headerContainer) Description copied from interface:RequestHeaderContainer.Builder
Copies all existing headers from the givenRequestHeaderContainer
.- Specified by:
withHeaders
in interfaceRequestHeaderContainer.Builder
- Parameters:
headerContainer
- TheRequestHeaderContainer
to copy the headers from.- Returns:
- This
RequestHeaderContainer.Builder
instance.
-
withHeader
@Nonnull public RequestHeaderContainer.Builder withHeader(@Nonnull String name, @Nonnull String firstValue, @Nonnull String... furtherValues) Description copied from interface:RequestHeaderContainer.Builder
Adds a new HTTP header with the given values to thisRequestHeaderContainer.Builder
.If the header does already exist, all given values will be added to it.
- Specified by:
withHeader
in interfaceRequestHeaderContainer.Builder
- Parameters:
name
- The name of the HTTP header. This is treated case insensitively.firstValue
- The first value of the HTTP header.furtherValues
- Further values of the HTTP header.- Returns:
- This
RequestHeaderContainer.Builder
instance.
-
withHeader
@Nonnull public RequestHeaderContainer.Builder withHeader(@Nonnull String name, @Nonnull Iterable<String> values) Description copied from interface:RequestHeaderContainer.Builder
Adds a new HTTP header with the given values to thisRequestHeaderContainer.Builder
.If the header does already exist, all given values will be added to it.
- Specified by:
withHeader
in interfaceRequestHeaderContainer.Builder
- Parameters:
name
- The name of the HTTP header. This is treated case insensitively.values
- The values of the HTTP header.- Returns:
- This
RequestHeaderContainer.Builder
instance.
-
withHeader
@Nonnull public RequestHeaderContainer.Builder withHeader(@Nonnull String name, @Nonnull RequestHeaderContainer headerContainer) Description copied from interface:RequestHeaderContainer.Builder
Copies the HTTP header with the givenname
- including all it's values - from theheaderContainer
.- Specified by:
withHeader
in interfaceRequestHeaderContainer.Builder
- Parameters:
name
- The name of the HTTP header.headerContainer
- TheRequestHeaderContainer
to copy the HTTP header from.- Returns:
- This
RequestHeaderContainer.Builder
instance.
-
withoutHeader
Description copied from interface:RequestHeaderContainer.Builder
Removes an HTTP header from thisRequestHeaderContainer.Builder
.- Specified by:
withoutHeader
in interfaceRequestHeaderContainer.Builder
- Parameters:
name
- The case insensitive name of the HTTP header.- Returns:
- This
RequestHeaderContainer.Builder
instance.
-
replaceHeader
@Nonnull public RequestHeaderContainer.Builder replaceHeader(@Nonnull String name, @Nonnull String firstValue, @Nonnull String... furtherValues) Description copied from interface:RequestHeaderContainer.Builder
Replaces an HTTP header in thisRequestHeaderContainer.Builder
.This method is semantically equivalent to
withoutHeader(name).withHeader(name, firstValue, furtherValues)
.- Specified by:
replaceHeader
in interfaceRequestHeaderContainer.Builder
- Parameters:
name
- The case insensitive name of the HTTP header.firstValue
- The first new value of the HTTP header.furtherValues
- Further new values of the HTTP header.- Returns:
- This
RequestHeaderContainer.Builder
instance.
-
replaceHeader
@Nonnull public RequestHeaderContainer.Builder replaceHeader(@Nonnull String name, @Nonnull Iterable<String> values) Description copied from interface:RequestHeaderContainer.Builder
Replaces an HTTP header in thisRequestHeaderContainer.Builder
.This method is semantically equivalent to
withoutHeader(name).withHeader(name, values)
.- Specified by:
replaceHeader
in interfaceRequestHeaderContainer.Builder
- Parameters:
name
- The case insensitive name of the HTTP header.values
- The new values of the HTTP header.- Returns:
- This
RequestHeaderContainer.Builder
instance.
-
replaceHeader
@Nonnull public RequestHeaderContainer.Builder replaceHeader(@Nonnull String name, @Nonnull RequestHeaderContainer headerContainer) Description copied from interface:RequestHeaderContainer.Builder
Replaces an HTTP header in thisRequestHeaderContainer.Builder
by copying the HTTP header of the givenheaderContainer
.This method is equivalent to
withoutHeader(name).withHeader(name, headerContainer)
.- Specified by:
replaceHeader
in interfaceRequestHeaderContainer.Builder
- Parameters:
name
- The case insensitive name of the HTTP header.headerContainer
- TheRequestHeaderContainer
to copy the HTTP header from.- Returns:
- This
RequestHeaderContainer.Builder
instance.
-
clear
Description copied from interface:RequestHeaderContainer.Builder
Removes all HTTP headers and cookies from thisRequestHeaderContainer.Builder
.- Specified by:
clear
in interfaceRequestHeaderContainer.Builder
- Returns:
- This
RequestHeaderContainer.Builder
instance.
-
build
Description copied from interface:RequestHeaderContainer.Builder
Initializes a new instance ofRequestHeaderContainer
from the HTTP headers and cookies contained in thisRequestHeaderContainer.Builder
.- Specified by:
build
in interfaceRequestHeaderContainer.Builder
- Returns:
- A new instance of
RequestHeaderContainer
.
-