Class DefaultOutboundHttpClientFactory
java.lang.Object
de.hybris.platform.outboundservices.client.impl.DefaultOutboundHttpClientFactory
- All Implemented Interfaces:
OutboundHttpClientFactory
Default implementation of the
OutboundHttpClientFactory-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates this factory.Instantiates this factory with the provided configuration service. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.http.client.HttpClientcreate()Creates aHttpClientprotected org.apache.http.impl.conn.PoolingHttpClientConnectionManagerCreates a connection manager to be used by theHttpClientthis factory createsprotected org.apache.http.client.config.RequestConfigCreates a request configuration to be used by theHttpClientthis factory creates.protected org.apache.http.impl.conn.PoolingHttpClientConnectionManagerCreates a connection manager that is configured then by thecreatePoolingHttpClientConnectionManager()method.protected org.apache.http.impl.client.HttpClientBuilderCreates anHttpClientBuilderused to create anHttpClientinstance.intprotected intintintvoidsetKeepAlive(int keepAlive) voidsetMaxConnections(int maxConnections) voidsetTimeout(int timeout) voidsetValidity(int validity)
-
Constructor Details
-
DefaultOutboundHttpClientFactory
public DefaultOutboundHttpClientFactory()Instantiates this factory. The instantiated factory uses a context configuration, which is defined in the application context as a Spring bean named"outboundServicesConfiguration" -
DefaultOutboundHttpClientFactory
Instantiates this factory with the provided configuration service.- Parameters:
cfg- implementation of the configuration service to use for retrieving configuration parameters for theHttpClientinstances created by this factory. Ifnull, then connection properties configured for this factory will be used.
-
-
Method Details
-
create
public org.apache.http.client.HttpClient create()Description copied from interface:OutboundHttpClientFactoryCreates aHttpClient- Specified by:
createin interfaceOutboundHttpClientFactory- Returns:
- HttpClient
-
createRequestConfig
protected org.apache.http.client.config.RequestConfig createRequestConfig()Creates a request configuration to be used by theHttpClientthis factory creates.- Returns:
- a configuration in the state to be used by the client "as is".
-
createPoolingHttpClientConnectionManager
protected org.apache.http.impl.conn.PoolingHttpClientConnectionManager createPoolingHttpClientConnectionManager()Creates a connection manager to be used by theHttpClientthis factory creates- Returns:
- a fully configured instance of connection manager to be used "as is" by the client.
-
getConnectionManager
protected org.apache.http.impl.conn.PoolingHttpClientConnectionManager getConnectionManager()Creates a connection manager that is configured then by thecreatePoolingHttpClientConnectionManager()method.- Returns:
- a fresh instance of the connection manager. This implementation also initializes the connection manager to work for HTTP and HTTPS connections.
-
getHttpClientBuilder
protected org.apache.http.impl.client.HttpClientBuilder getHttpClientBuilder()Creates anHttpClientBuilderused to create anHttpClientinstance. The builder is then populated with the request configuration created bycreateRequestConfig()method, and the connection manager created by thecreatePoolingHttpClientConnectionManager(), the keep alive setting.- Returns:
- an instance of the builder.
-
getMaxConnections
protected int getMaxConnections() -
setMaxConnections
public void setMaxConnections(int maxConnections) -
getKeepAlive
public int getKeepAlive() -
setKeepAlive
public void setKeepAlive(int keepAlive) -
getTimeout
public int getTimeout() -
setTimeout
public void setTimeout(int timeout) -
getValidity
public int getValidity() -
setValidity
public void setValidity(int validity)
-