Package com.oracle.bmc.http
Class DefaultConfigurator
- java.lang.Object
-
- com.oracle.bmc.http.DefaultConfigurator
-
- All Implemented Interfaces:
ClientConfigurator,HasEffectiveClientConfigurator,SetsClientBuilderProperties
- Direct Known Subclasses:
DefaultConfigurator.NonBuffering
public class DefaultConfigurator extends Object implements ClientConfigurator, HasEffectiveClientConfigurator, SetsClientBuilderProperties
DefaultConfigurator handles basic configuration of clients under different environments.This is the configurator used by the REST client factory when no configurator is provided by the SDK user.
It currently does the following:
- Checks for the presence of Apache Config Classes and creates the appropriate configurator
If the default configurator results in any issues, callers can provide their own implementation when constructing service objects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultConfigurator.NonBufferingAClientConfiguratorfor a client that does not buffer requests in memory.
-
Field Summary
Fields Modifier and Type Field Description protected static StringAPACHE_CONNECTOR_CLASS_NAMEprotected static StringAPACHE_HTTP_CLIENT_CONFIG_CLASS_NAMEprotected List<ClientConfigDecorator>clientConfigDecoratorsThe list of ClientConfigDecorators to support the ability to decorate ClientConfig
-
Constructor Summary
Constructors Constructor Description DefaultConfigurator()Creates a new DefaultConfigurator object.DefaultConfigurator(List<ClientConfigDecorator> clientConfigDecorators)Creates a new DefaultConfigurator and registers the list of provided ClientConfigDecorators.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcustomizeBuilder(javax.ws.rs.client.ClientBuilder builder)Customize the ClientBuilder instance.voidcustomizeClient(javax.ws.rs.client.Client client)Customize the Client generated by the builder.voidcustomizeRequest(BmcRequest<?> request, WrappedInvocationBuilder ib)Customize a request before it is made.ClientConfiguratorgetEffectiveClientConfigurator()Get the effective ClientConfiguratorstatic booleanisApacheDependencyPresent()voidsetConnectorProvider(javax.ws.rs.client.ClientBuilder builder)Sets the custom ConnectorProvider to use.voidsetSslContext(javax.ws.rs.client.ClientBuilder builder)Sets the SSL context on the builder.
-
-
-
Field Detail
-
APACHE_HTTP_CLIENT_CONFIG_CLASS_NAME
protected static final String APACHE_HTTP_CLIENT_CONFIG_CLASS_NAME
- See Also:
- Constant Field Values
-
APACHE_CONNECTOR_CLASS_NAME
protected static final String APACHE_CONNECTOR_CLASS_NAME
- See Also:
- Constant Field Values
-
clientConfigDecorators
protected final List<ClientConfigDecorator> clientConfigDecorators
The list of ClientConfigDecorators to support the ability to decorate ClientConfig
-
-
Constructor Detail
-
DefaultConfigurator
public DefaultConfigurator()
Creates a new DefaultConfigurator object.
-
DefaultConfigurator
public DefaultConfigurator(List<ClientConfigDecorator> clientConfigDecorators)
Creates a new DefaultConfigurator and registers the list of provided ClientConfigDecorators.- Parameters:
clientConfigDecorators- the list of client configuration decorators
-
-
Method Detail
-
isApacheDependencyPresent
public static boolean isApacheDependencyPresent()
-
customizeBuilder
public void customizeBuilder(javax.ws.rs.client.ClientBuilder builder)
Description copied from interface:ClientConfiguratorCustomize the ClientBuilder instance.- Specified by:
customizeBuilderin interfaceClientConfigurator- Parameters:
builder- The client builder.
-
customizeClient
public void customizeClient(javax.ws.rs.client.Client client)
Description copied from interface:ClientConfiguratorCustomize the Client generated by the builder.- Specified by:
customizeClientin interfaceClientConfigurator- Parameters:
client- The client.
-
setConnectorProvider
public void setConnectorProvider(javax.ws.rs.client.ClientBuilder builder)
Sets the custom ConnectorProvider to use.Subclasses can override this to be a no-op if they do not want to use the custom connector, or wish to set their own.
- Specified by:
setConnectorProviderin interfaceSetsClientBuilderProperties- Parameters:
builder- The builder to set the provider on
-
setSslContext
public void setSslContext(javax.ws.rs.client.ClientBuilder builder)
Sets the SSL context on the builder.Separate so subclasses can call if desired.
- Specified by:
setSslContextin interfaceSetsClientBuilderProperties- Parameters:
builder- The client builder to use.
-
customizeRequest
public void customizeRequest(BmcRequest<?> request, WrappedInvocationBuilder ib)
Description copied from interface:ClientConfiguratorCustomize a request before it is made.- Specified by:
customizeRequestin interfaceClientConfigurator- Parameters:
request- The requestib- the invocation builder
-
getEffectiveClientConfigurator
public ClientConfigurator getEffectiveClientConfigurator()
Description copied from interface:HasEffectiveClientConfiguratorGet the effective ClientConfigurator- Specified by:
getEffectiveClientConfiguratorin interfaceHasEffectiveClientConfigurator- Returns:
- the effective ClientConfigurator
-
-