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 - GetObjectReponse.getInputStream().close or try-with-resources. Otherwise, the connection is not released from the pool and results in hanging for an indefinite time.
| Modifier and Type | Class and Description |
|---|---|
static class |
ApacheConfigurator.NonBuffering |
| Modifier and Type | Field and Description |
|---|---|
protected ApacheConnectorProperties |
apacheConnectorProperties
Getter for ApacheConnectorProperties for the Apache Connection *
|
protected List<ClientConfigDecorator> |
clientConfigDecorators
The list of
ClientConfigDecorators to support the ability to decorate ClientConfig |
| Constructor and Description |
|---|
ApacheConfigurator()
Creates a new
ApacheConfigurator object. |
ApacheConfigurator(ApacheConnectorProperties apacheConnectorProperties)
Creates a new
ApacheConfigurator object and sets the ApacheConnectorProperties |
ApacheConfigurator(ApacheConnectorProperties apacheConnectorProperties,
List<ClientConfigDecorator> clientConfigDecorators)
Creates a new
ApacheConfigurator object and sets the ApacheConnectorProperties and registers the list of provided ClientConfigDecorators |
ApacheConfigurator(List<ClientConfigDecorator> clientConfigDecorators)
Creates a new
ApacheConfigurator and registers the list of provided ClientConfigDecorators. |
| Modifier and Type | Method and Description |
|---|---|
void |
customizeBuilder(javax.ws.rs.client.ClientBuilder builder)
Customize the ClientBuilder instance.
|
void |
customizeClient(javax.ws.rs.client.Client client)
Customize the Client generated by the builder.
|
void |
customizeRequest(BmcRequest<?> request,
WrappedInvocationBuilder ib)
Customize a request before it is made.
|
ApacheConnectorProperties |
getApacheConnectorProperties()
Get the Apache Connector Properties
|
void |
setConnectorProvider(javax.ws.rs.client.ClientBuilder builder)
Sets the custom ConnectorProvider to use.
|
void |
setSslContext(javax.ws.rs.client.ClientBuilder builder)
Sets the SSL context on the builder.
|
protected final List<ClientConfigDecorator> clientConfigDecorators
The list of ClientConfigDecorators to support the ability to decorate ClientConfig
protected ApacheConnectorProperties apacheConnectorProperties
Getter for ApacheConnectorProperties for the Apache Connection *
public ApacheConfigurator()
Creates a new ApacheConfigurator object.
public ApacheConfigurator(List<ClientConfigDecorator> clientConfigDecorators)
Creates a new ApacheConfigurator and registers the list of provided ClientConfigDecorators.
clientConfigDecorators - the list of client configuration decoratorspublic ApacheConfigurator(@Nonnull ApacheConnectorProperties apacheConnectorProperties)
Creates a new ApacheConfigurator object and sets the ApacheConnectorProperties
public ApacheConfigurator(@Nonnull ApacheConnectorProperties apacheConnectorProperties, List<ClientConfigDecorator> clientConfigDecorators)
Creates a new ApacheConfigurator object and sets the ApacheConnectorProperties and registers the list of provided ClientConfigDecorators
public void customizeBuilder(javax.ws.rs.client.ClientBuilder builder)
ClientConfiguratorCustomize the ClientBuilder instance.
customizeBuilder in interface ClientConfiguratorbuilder - The client builder.public void customizeClient(javax.ws.rs.client.Client client)
ClientConfiguratorCustomize the Client generated by the builder.
customizeClient in interface ClientConfiguratorclient - The client.public void setConnectorProvider(javax.ws.rs.client.ClientBuilder builder)
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.
setConnectorProvider in interface SetsClientBuilderPropertiesbuilder - The builder to set the provider onpublic void setSslContext(javax.ws.rs.client.ClientBuilder builder)
Sets the SSL context on the builder.
Separate so subclasses can call if desired.
setSslContext in interface SetsClientBuilderPropertiesbuilder - The client builder to use.public ApacheConnectorProperties getApacheConnectorProperties()
HasApacheConnectorPropertiesGet the Apache Connector Properties
getApacheConnectorProperties in interface HasApacheConnectorPropertiespublic void customizeRequest(BmcRequest<?> request, WrappedInvocationBuilder ib)
ClientConfiguratorCustomize a request before it is made.
customizeRequest in interface ClientConfiguratorrequest - The requestib - the invocation builderCopyright © 2016–2022. All rights reserved.