Class RDF4JHttpClientConfig.Builder
java.lang.Object
org.eclipse.rdf4j.http.client.spi.RDF4JHttpClientConfig.Builder
- Enclosing class:
RDF4JHttpClientConfig
Builder for
RDF4JHttpClientConfig.
Default values:
connectTimeoutMs= 30,000 mssocketTimeoutMs= 0 (infinite)connectionRequestTimeoutMs= 3,600,000 ms (1 hour)maxConnectionsPerRoute= 25maxConnectionsTotal= 50maxRedirects= 5followRedirects=trueidleConnectionTimeoutMs= 300,000 ms (5 minutes)sslContext= none (uses JVM default)disableHostnameVerification=false
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newRDF4JHttpClientConfigfrom the current builder state.connectionRequestTimeoutMs(int connectionRequestTimeoutMs) Sets the connection request timeout in milliseconds.connectTimeoutMs(int connectTimeoutMs) Sets the connection timeout in milliseconds.defaultHeader(String name, String value) Adds a single default HTTP header to be sent with every request.defaultHeaders(List<HttpHeader> defaultHeaders) Sets the default HTTP headers to be sent with every request.disableHostnameVerification(boolean disableHostnameVerification) Disables TLS hostname verification.followRedirects(boolean followRedirects) Sets whether HTTP redirects should be followed automatically.idleConnectionTimeoutMs(long idleConnectionTimeoutMs) Sets the maximum time that a pooled connection may remain idle before being evicted.maxConnectionsPerRoute(int maxConnectionsPerRoute) Sets the maximum number of concurrent connections per route (i.e. per target host).maxConnectionsTotal(int maxConnectionsTotal) Sets the maximum total number of concurrent connections across all routes.maxRedirects(int maxRedirects) Sets the maximum number of redirects to follow when redirect following is enabled.socketTimeoutMs(int socketTimeoutMs) Sets the socket (read) timeout in milliseconds.sslContext(SSLContext sslContext) Sets a customSSLContextfor HTTPS connections.
-
Constructor Details
-
Builder
protected Builder()
-
-
Method Details
-
connectTimeoutMs
Sets the connection timeout in milliseconds.- Parameters:
connectTimeoutMs- connection timeout in milliseconds; must be non-negative- Returns:
- this builder
-
socketTimeoutMs
Sets the socket (read) timeout in milliseconds. Use0for an infinite timeout.- Parameters:
socketTimeoutMs- socket timeout in milliseconds; must be non-negative- Returns:
- this builder
-
connectionRequestTimeoutMs
Sets the connection request timeout in milliseconds. This is the maximum time to wait when requesting a connection from the connection pool.- Parameters:
connectionRequestTimeoutMs- connection request timeout in milliseconds; must be non-negative- Returns:
- this builder
-
maxConnectionsPerRoute
Sets the maximum number of concurrent connections per route (i.e. per target host).- Parameters:
maxConnectionsPerRoute- maximum connections per route; must be positive- Returns:
- this builder
-
maxConnectionsTotal
Sets the maximum total number of concurrent connections across all routes.- Parameters:
maxConnectionsTotal- maximum total connections; must be positive- Returns:
- this builder
-
maxRedirects
Sets the maximum number of redirects to follow when redirect following is enabled.- Parameters:
maxRedirects- maximum number of redirects; must be non-negative- Returns:
- this builder
-
followRedirects
Sets whether HTTP redirects should be followed automatically.- Parameters:
followRedirects-trueto follow redirects,falseto disable- Returns:
- this builder
-
idleConnectionTimeoutMs
Sets the maximum time that a pooled connection may remain idle before being evicted. Use0to disable idle eviction.- Parameters:
idleConnectionTimeoutMs- idle timeout in milliseconds; must be non-negative- Returns:
- this builder
-
sslContext
Sets a customSSLContextfor HTTPS connections. If not set, the JVM default SSL context is used.- Parameters:
sslContext- theSSLContextto use, ornullto use the JVM default- Returns:
- this builder
-
disableHostnameVerification
public RDF4JHttpClientConfig.Builder disableHostnameVerification(boolean disableHostnameVerification) Disables TLS hostname verification. When set totrue, 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 with hostname mismatches).
- Parameters:
disableHostnameVerification-trueto disable hostname verification- Returns:
- this builder
-
defaultHeaders
Sets the default HTTP headers to be sent with every request.- Parameters:
defaultHeaders- the headers to send by default; must not benull- Returns:
- this builder
-
defaultHeader
Adds a single default HTTP header to be sent with every request.- Parameters:
name- the header name; must not benullvalue- the header value; must not benull- Returns:
- this builder
-
build
Builds a newRDF4JHttpClientConfigfrom the current builder state.- Returns:
- a new
RDF4JHttpClientConfig
-