Class RDF4JHttpClientConfig

java.lang.Object
org.eclipse.rdf4j.http.client.spi.RDF4JHttpClientConfig

public class RDF4JHttpClientConfig extends Object
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:
  • Constructor Details

  • 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 of 0 means an infinite timeout.
      Returns:
      socket timeout in milliseconds, or 0 for 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 when isFollowRedirects() is true.
      Returns:
      maximum number of redirects
    • isFollowRedirects

      public boolean isFollowRedirects()
      Returns whether HTTP redirects are followed automatically.
      Returns:
      true if redirects are followed, false otherwise
    • getIdleConnectionTimeoutMs

      public long getIdleConnectionTimeoutMs()
      Returns the maximum time in milliseconds that a pooled connection may remain idle before being evicted. A value of 0 disables idle eviction.
      Returns:
      idle connection timeout in milliseconds
    • getSslContext

      public Optional<SSLContext> getSslContext()
      Returns the SSLContext to use for HTTPS connections, if one has been configured.
      Returns:
      an Optional containing the configured SSLContext, or empty if none was set
    • isDisableHostnameVerification

      public boolean isDisableHostnameVerification()
      Returns whether TLS hostname verification is disabled. When true, 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:
      true if hostname verification is disabled, false otherwise
    • getDefaultHeaders

      public List<HttpHeader> 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

      public RDF4JHttpClientConfig.Builder toBuilder()
      Returns a new RDF4JHttpClientConfig.Builder pre-populated with all settings from this config. Useful for creating a modified copy without having to re-specify every field.
      Returns:
      a RDF4JHttpClientConfig.Builder seeded from this config
    • defaultConfig

      public static RDF4JHttpClientConfig defaultConfig()
      Returns a new RDF4JHttpClientConfig with all settings at their default values.
      Returns:
      a default RDF4JHttpClientConfig
    • newBuilder

      public static RDF4JHttpClientConfig.Builder newBuilder()
      Returns a new RDF4JHttpClientConfig.Builder for constructing an RDF4JHttpClientConfig.
      Returns:
      a new RDF4JHttpClientConfig.Builder