HttpClientConfig
Overview
The HttpClientConfig
object provides configurable properties to manage the behavior of an HTTP client, including settings for SSL/TLS, connection limits, protocol preferences, and user agent configuration. ## Functionality
SSL/TLS and Security
certPath
andcertPassword
specify the client certificate location and password.trustStorePath
andtrustStorePassword
define the truststore for trusted certificates.protocol
sets the TLS protocol, defaulting to TLS.hostValidation
disables hostname validation, primarily for testing purposes.
Connection Management
keepAliveDuration
sets the duration (in seconds) for keeping connections alive.maxConnectionsPerRoute
andmaxTotalConnections
limit the number of connections managed by the client.maxIOThreadCount
determines the number of input/output threads for the client.
Additional Features
enableRedirects
enables or disables automatic following of HTTP redirects.forceHttp1
forces HTTP/1.1 usage when HTTP/2 compatibility issues arise.multiPartLegacyMode
switches multipart request handling to a non-buffered mode.userAgent
allows customization of the HTTP client’s user agent string.
Properties Summarized
Force the use of http1, use this if there are problems connecting to a server that does use http/2 but uses old cipher suites or if there are other problems like http/2 not setting the content length and the server still wants it.
Gets/Sets keep alive duration in seconds for a connection, default is -1 (no duration specified).
Gets/Sets maximum number of connections per route used by Connection Manager.
Gets/Sets maximum number of input/output threads per client, default value is 2.
Sets whether multipart request should be written in one go(not using buffering).
Gets/Sets the password to the java truststore where to import the certificate.
Properties Detailed
certPassword
Gets/Sets the certificate password. The following sample sets up an HttpClient with custom SSL/TLS configuration using a PKCS12 keystore for client certificates and a JKS truststore for trusted certificate authorities.
Type String
Sample
certPath
Gets/Sets the certificate path. The following sample sets up an HttpClient with custom SSL/TLS configuration using a PKCS12 keystore for client certificates and a JKS truststore for trusted certificate authorities.
Type String
Sample
enableRedirects
Sets whether client should follow redirects or you want to do it manually. Default value is true.
Type Boolean
Sample
forceHttp1
Force the use of http1, use this if there are problems connecting to a server that does use http/2 but uses old cipher suites or if there are other problems like http/2 not setting the content length and the server still wants it.
Type Boolean
Sample
hostValidation
Disable hostname certificate validation. This should be used only for testing purposes, because this is not secure!
Type Boolean
Sample
keepAliveDuration
Gets/Sets keep alive duration in seconds for a connection, default is -1 (no duration specified).
Type Number
Sample
maxConnectionsPerRoute
Gets/Sets maximum number of connections per route used by Connection Manager.
Type Number
Sample
maxIOThreadCount
Gets/Sets maximum number of input/output threads per client, default value is 2.
Type Number
Sample
maxTotalConnections
Gets/Sets maximum number of connections used by Connection Manager.
Type Number
Sample
multiPartLegacyMode
Sets whether multipart request should be written in one go(not using buffering). Default value is false.
Type Boolean
Sample
protocol
Gets/Sets which TLS protocol to use, default value is TLS.
Type String
Sample
trustStorePassword
Gets/Sets the password to the java truststore where to import the certificate. The following sample sets up an HttpClient with custom SSL/TLS configuration using a PKCS12 keystore for client certificates and a JKS truststore for trusted certificate authorities.
Type String
Sample
userAgent
Gets/Sets custom userAgent to use.
Type String
Sample
Last updated