Class ApacheConfigurator
- java.lang.Object
-
- com.oracle.bmc.http.ApacheConfigurator
-
- All Implemented Interfaces:
ClientConfigurator,HasApacheConnectorProperties,SetsClientBuilderProperties
- Direct Known Subclasses:
ApacheConfigurator.NonBuffering,ConnectionPoolingApacheConfigurator
public class ApacheConfigurator extends Object implements ClientConfigurator, SetsClientBuilderProperties, HasApacheConnectorProperties
A ClientConfigurator implementation that uses the Apache HTTP Connector Provider for the Jersey Client configuration.This enables support for connection pooling in addition to per-client HTTP(S) proxy support.
Note: Use of the ApacheConnectorProvider will buffer requests into memory and can impact memory utilization within your application. To avoid buffering of requests in memory, please use ApacheConfigurator.NonBuffering Apache Configurator by default configures a connection pool with default values for defaultMaxConnectionsPerRoute and maximum open connections. Please make sure to close all InputStreams obtained from the response object by calling close on the stream object. For example - GetObjectResponse.getInputStream().close or try-with-resources. Otherwise, the connection is not released from the pool and results in hanging for an indefinite time.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classApacheConfigurator.NonBuffering
-
Field Summary
Fields Modifier and Type Field Description protected ApacheConnectorPropertiesapacheConnectorPropertiesGetter for ApacheConnectorProperties for the Apache Connection *protected List<ClientConfigDecorator>clientConfigDecoratorsThe list of ClientConfigDecorators to support the ability to decorate ClientConfig
-
Constructor Summary
Constructors Constructor Description ApacheConfigurator()Creates a new ApacheConfigurator object.ApacheConfigurator(ApacheConnectorProperties apacheConnectorProperties)Creates a new ApacheConfigurator object and sets the ApacheConnectorPropertiesApacheConfigurator(ApacheConnectorProperties apacheConnectorProperties, List<ClientConfigDecorator> clientConfigDecorators)Creates a new ApacheConfigurator object and sets the ApacheConnectorProperties and registers the list of provided ClientConfigDecoratorsApacheConfigurator(List<ClientConfigDecorator> clientConfigDecorators)Creates a new ApacheConfigurator and registers the list of provided ClientConfigDecorators.
-
Method Summary
All 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.ApacheConnectorPropertiesgetApacheConnectorProperties()Get the Apache Connector PropertiesvoidsetConnectorProvider(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
-
clientConfigDecorators
protected final List<ClientConfigDecorator> clientConfigDecorators
The list of ClientConfigDecorators to support the ability to decorate ClientConfig
-
apacheConnectorProperties
protected ApacheConnectorProperties apacheConnectorProperties
Getter for ApacheConnectorProperties for the Apache Connection *
-
-
Constructor Detail
-
ApacheConfigurator
public ApacheConfigurator()
Creates a new ApacheConfigurator object.
-
ApacheConfigurator
public ApacheConfigurator(List<ClientConfigDecorator> clientConfigDecorators)
Creates a new ApacheConfigurator and registers the list of provided ClientConfigDecorators.- Parameters:
clientConfigDecorators- the list of client configuration decorators
-
ApacheConfigurator
public ApacheConfigurator(@Nonnull ApacheConnectorProperties apacheConnectorProperties)
Creates a new ApacheConfigurator object and sets the ApacheConnectorProperties
-
ApacheConfigurator
public ApacheConfigurator(@Nonnull ApacheConnectorProperties apacheConnectorProperties, List<ClientConfigDecorator> clientConfigDecorators)
Creates a new ApacheConfigurator object and sets the ApacheConnectorProperties and registers the list of provided ClientConfigDecorators
-
-
Method Detail
-
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)
Description copied from interface:SetsClientBuilderPropertiesSets 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.
-
getApacheConnectorProperties
public ApacheConnectorProperties getApacheConnectorProperties()
Description copied from interface:HasApacheConnectorPropertiesGet the Apache Connector Properties- Specified by:
getApacheConnectorPropertiesin interfaceHasApacheConnectorProperties- Returns:
- the Apache Connector Properties
-
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
-
-