Class DefaultHttpDestination.Builder
java.lang.Object
com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination.Builder
- Enclosing class:
- DefaultHttpDestination
Builder class to allow for easy creation of an immutable
DefaultHttpDestination
instance.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionauthenticationType
(AuthenticationType authenticationType) Sets the expected authentication type of theDefaultHttpDestination
.basicCredentials
(BasicCredentials basicCredentials) Sets the credentials for accessing the destination when basic authentication is used.basicCredentials
(String user, String password) Sets the credentials for accessing the destination usingAuthenticationType.BASIC_AUTHENTICATION
.build()
Finally creates theDefaultHttpDestination
with the properties retrieved via theproperty(String, Object)
method.cloudConnectorLocationId
(String locationId) Sets the connectivity location id of the destination.Adds the given header to the list of headers added to every outgoing request for this destination.Adds a header given by theheaderName
andheaderValue
to the list of headers added to every outgoing request for this destination.headerProviders
(DestinationHeaderProvider... headerProviders) Registers the providedDestinationHeaderProvider
instances on this Destination.headers
(Collection<Header> headers) Adds the given headers to the list of headers added to every outgoing request for this destination.TheKeyStore
to be used when communicating over HTTP.keyStorePassword
(String value) Sets the key store password for the correspondingKeyStore
used by theDefaultHttpDestination
to access the key store.Sets the name of theDefaultHttpDestination
.<ValueT> DefaultHttpDestination.Builder
property
(DestinationPropertyKey<ValueT> key, ValueT value) Adds the given key-value pair to the destination to be created.Adds the given key-value pair to the destination to be created.Sets the proxy host and proxy port of theDefaultHttpDestination
.Sets the proxy URI of theDefaultHttpDestination
.proxyAuthorization
(String proxyAuthorization) Sets the proxy authorization header of theDefaultHttpDestination
.Sets the proxy used by the destination to the given value.Sets the proxy type (Internet or On-Premise).removeProperty
(DestinationPropertyKey<?> key) Removes the property with the given key from the destination to be created.removeProperty
(String key) Removes the property with the given key from the destination to be created.securityConfiguration
(SecurityConfigurationStrategy securityConfigurationStrategy) Sets theSecurityConfigurationStrategy
for outbound calls via this Destination to decide if theSSLContext
should be derived from the Destination Configuration or from the cloud platform (i.e. the environment).tlsVersion
(String value) Sets the TLS version used by theDefaultHttpDestination
to the given value.Lets theDefaultHttpDestination
trust all server certificates.trustStore
(KeyStore trustStore) The trust store to be used when communicating over HTTP.trustStorePassword
(String value) Sets the password of the trust store.Sets the URI of the to-be-builtDefaultHttpDestination
.Sets the URI of the to-be-builtDefaultHttpDestination
.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
property
Adds the given key-value pair to the destination to be created. This will overwrite any property already assigned to the key.- Parameters:
key
- The key to assign a property for.value
- The property value to be assigned.- Returns:
- This builder.
- Since:
- 5.0.0
-
property
@Nonnull public <ValueT> DefaultHttpDestination.Builder property(@Nonnull DestinationPropertyKey<ValueT> key, @Nonnull ValueT value) Adds the given key-value pair to the destination to be created. This will overwrite any property already assigned to the key.- Type Parameters:
ValueT
- The type of the property value.- Parameters:
key
- TheDestinationPropertyKey
to assign a property for.value
- The property value to be assigned.- Returns:
- This builder.
- Since:
- 5.0.0
-
removeProperty
@Nonnull public DefaultHttpDestination.Builder removeProperty(@Nonnull DestinationPropertyKey<?> key) Removes the property with the given key from the destination to be created. This is useful when creating a builder from an existing destination and wanting to remove a property.- Parameters:
key
- TheDestinationPropertyKey
of the property to remove.- Returns:
- This builder.
-
removeProperty
Removes the property with the given key from the destination to be created. This is useful when creating a builder from an existing destination and wanting to remove a property.- Parameters:
key
- The key of the property to remove.- Returns:
- This builder.
-
name
Sets the name of theDefaultHttpDestination
.- Parameters:
name
- The destination name- Returns:
- This builder.
-
uri
Sets the URI of the to-be-builtDefaultHttpDestination
.- Parameters:
uri
- The URI to set.- Returns:
- This builder.
- Since:
- 5.0.0
-
uri
Sets the URI of the to-be-builtDefaultHttpDestination
.- Parameters:
uri
- The URI to set.- Returns:
- This builder.
- Since:
- 5.0.0
-
tlsVersion
Sets the TLS version used by theDefaultHttpDestination
to the given value.- Parameters:
value
- The TLS version that should be used.- Returns:
- This builder.
-
keyStorePassword
Sets the key store password for the correspondingKeyStore
used by theDefaultHttpDestination
to access the key store.- Parameters:
value
- The keyStore password that should be used.- Returns:
- This builder.
-
trustAllCertificates
Lets theDefaultHttpDestination
trust all server certificates.- Returns:
- This builder.
-
trustStorePassword
Sets the password of the trust store.- Parameters:
value
- The trust store password that should be used.- Returns:
- This builder.
-
cloudConnectorLocationId
Sets the connectivity location id of the destination.- Parameters:
locationId
- The location identifier for connecting to SAP Cloud Connector.- Returns:
- This builder.
-
proxyConfiguration
@Nonnull public DefaultHttpDestination.Builder proxyConfiguration(@Nonnull ProxyConfiguration value) Sets the proxy used by the destination to the given value.- Parameters:
value
- The proxy that should be used.- Returns:
- This builder.
-
headers
Adds the given headers to the list of headers added to every outgoing request for this destination.- Parameters:
headers
- Headers to add to outgoing requests.- Returns:
- This builder.
-
proxy
Sets the proxy URI of theDefaultHttpDestination
.- Parameters:
proxyUri
- The URI of the proxy- Returns:
- This builder.
-
proxyAuthorization
@Nonnull public DefaultHttpDestination.Builder proxyAuthorization(@Nonnull String proxyAuthorization) Sets the proxy authorization header of theDefaultHttpDestination
.- Parameters:
proxyAuthorization
- The authorization header value- Returns:
- This builder.
-
proxyType
Sets the proxy type (Internet or On-Premise).- Parameters:
proxyType
- Type of proxy this destination is configured for.- Returns:
- This builder.
-
proxy
Sets the proxy host and proxy port of theDefaultHttpDestination
.- Parameters:
proxyHost
- The host of the proxyproxyPort
- The port of the proxy- Returns:
- This builder.
-
basicCredentials
@Nonnull public DefaultHttpDestination.Builder basicCredentials(@Nonnull BasicCredentials basicCredentials) Sets the credentials for accessing the destination when basic authentication is used.- Parameters:
basicCredentials
- Username and password represented as aBasicCredentials
object.- Returns:
- This builder.
-
basicCredentials
@Nonnull public DefaultHttpDestination.Builder basicCredentials(@Nonnull String user, @Nonnull String password) Sets the credentials for accessing the destination usingAuthenticationType.BASIC_AUTHENTICATION
.- Parameters:
user
- The user.password
- The password.- Returns:
- This builder.
-
authenticationType
@Nonnull public DefaultHttpDestination.Builder authenticationType(@Nonnull AuthenticationType authenticationType) Sets the expected authentication type of theDefaultHttpDestination
.- Parameters:
authenticationType
- The type of authentication for the destination- Returns:
- This builder.
-
header
Adds the given header to the list of headers added to every outgoing request for this destination.- Parameters:
header
- A header to add to outgoing requests.- Returns:
- This builder.
-
header
@Nonnull public DefaultHttpDestination.Builder header(@Nonnull String headerName, @Nonnull String headerValue) Adds a header given by theheaderName
andheaderValue
to the list of headers added to every outgoing request for this destination.- Parameters:
headerName
- The name of the header to add.headerValue
- The value of the header to add.- Returns:
- This builder.
-
securityConfiguration
@Nonnull public DefaultHttpDestination.Builder securityConfiguration(@Nonnull SecurityConfigurationStrategy securityConfigurationStrategy) Sets theSecurityConfigurationStrategy
for outbound calls via this Destination to decide if theSSLContext
should be derived from the Destination Configuration or from the cloud platform (i.e. the environment).- Parameters:
securityConfigurationStrategy
- The strategy to use- Returns:
- This builder
-
headerProviders
@Nonnull public DefaultHttpDestination.Builder headerProviders(@Nonnull DestinationHeaderProvider... headerProviders) Registers the providedDestinationHeaderProvider
instances on this Destination.For all outgoing requests, the registered header providers are invoked and the returned
headers
are added to the request.- Parameters:
headerProviders
- The header provider instances- Returns:
- This builder
-
build
Finally creates theDefaultHttpDestination
with the properties retrieved via theproperty(String, Object)
method.- Returns:
- A fully instantiated
DefaultHttpDestination
.
-
keyStore
TheKeyStore
to be used when communicating over HTTP.- Returns:
this
.
-
trustStore
The trust store to be used when communicating over HTTP.- Returns:
this
.
-