Class RDF4JHttpClientConfig
java.lang.Object
org.eclipse.rdf4j.http.client.spi.RDF4JHttpClientConfig
Immutable configuration for an
RDF4JHttpClient.
Instances are created via the RDF4JHttpClientConfig.Builder, which can be obtained from newBuilder(). A default
configuration is available via defaultConfig().
Example usage:
HttpClientConfig config = HttpClientConfig.newBuilder()
.connectTimeoutMs(5_000)
.socketTimeoutMs(30_000)
.followRedirects(true)
.build();
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionstatic RDF4JHttpClientConfigReturns a newRDF4JHttpClientConfigwith all settings at their default values.intReturns the connection request timeout in milliseconds.intReturns the connection timeout in milliseconds.Returns the default HTTP headers to be sent with every request.longReturns the maximum time in milliseconds that a pooled connection may remain idle before being evicted.intReturns the maximum number of concurrent connections per route (i.e. per target host).intReturns the maximum total number of concurrent connections across all routes.intReturns the maximum number of redirects to follow whenisFollowRedirects()istrue.intReturns the socket (read) timeout in milliseconds.Returns theSSLContextto use for HTTPS connections, if one has been configured.booleanReturns whether TLS hostname verification is disabled.booleanReturns whether HTTP redirects are followed automatically.Returns a newRDF4JHttpClientConfig.Builderfor constructing anRDF4JHttpClientConfig.Returns a newRDF4JHttpClientConfig.Builderpre-populated with all settings from this config.
-
Constructor Details
-
RDF4JHttpClientConfig
-
-
Method Details
-
getConnectTimeoutMs
public int getConnectTimeoutMs()Returns the connection timeout in milliseconds. This is the maximum time to wait for a connection to be established.- Returns:
- connection timeout in milliseconds
-
getSocketTimeoutMs
public int getSocketTimeoutMs()Returns the socket (read) timeout in milliseconds. This is the maximum time to wait for data after the connection is established. A value of0means an infinite timeout.- Returns:
- socket timeout in milliseconds, or
0for no timeout
-
getConnectionRequestTimeoutMs
public int getConnectionRequestTimeoutMs()Returns the connection request timeout in milliseconds. This is the maximum time to wait when requesting a connection from the connection pool.- Returns:
- connection request timeout in milliseconds
-
getMaxConnectionsPerRoute
public int getMaxConnectionsPerRoute()Returns the maximum number of concurrent connections per route (i.e. per target host).- Returns:
- maximum connections per route
-
getMaxConnectionsTotal
public int getMaxConnectionsTotal()Returns the maximum total number of concurrent connections across all routes.- Returns:
- maximum total connections
-
getMaxRedirects
public int getMaxRedirects()Returns the maximum number of redirects to follow whenisFollowRedirects()istrue.- Returns:
- maximum number of redirects
-
isFollowRedirects
public boolean isFollowRedirects()Returns whether HTTP redirects are followed automatically.- Returns:
trueif redirects are followed,falseotherwise
-
getIdleConnectionTimeoutMs
public long getIdleConnectionTimeoutMs()Returns the maximum time in milliseconds that a pooled connection may remain idle before being evicted. A value of0disables idle eviction.- Returns:
- idle connection timeout in milliseconds
-
getSslContext
Returns theSSLContextto use for HTTPS connections, if one has been configured.- Returns:
- an
Optionalcontaining the configuredSSLContext, or empty if none was set
-
isDisableHostnameVerification
public boolean isDisableHostnameVerification()Returns whether TLS hostname verification is disabled. Whentrue, the client will accept certificates even if the hostname does not match the certificate's CN/SAN fields.Warning: disabling hostname verification removes an important security check. Only use this in controlled environments (e.g. testing against self-signed certificates).
- Returns:
trueif hostname verification is disabled,falseotherwise
-
getDefaultHeaders
Returns the default HTTP headers to be sent with every request.- Returns:
- an unmodifiable list of default headers; never
null, may be empty
-
toBuilder
Returns a newRDF4JHttpClientConfig.Builderpre-populated with all settings from this config. Useful for creating a modified copy without having to re-specify every field.- Returns:
- a
RDF4JHttpClientConfig.Builderseeded from this config
-
defaultConfig
Returns a newRDF4JHttpClientConfigwith all settings at their default values.- Returns:
- a default
RDF4JHttpClientConfig
-
newBuilder
Returns a newRDF4JHttpClientConfig.Builderfor constructing anRDF4JHttpClientConfig.- Returns:
- a new
RDF4JHttpClientConfig.Builder
-