Class ApacheHC5RDF4JHttpClientFactory

java.lang.Object
org.eclipse.rdf4j.http.client.apache5.ApacheHC5RDF4JHttpClientFactory
All Implemented Interfaces:
RDF4JHttpClientFactory

public class ApacheHC5RDF4JHttpClientFactory extends Object implements RDF4JHttpClientFactory
RDF4JHttpClientFactory implementation that uses Apache HttpComponents 5.

Subclasses may override buildHttpClient(HttpClientBuilder, RDF4JHttpClientConfig) to apply additional configuration to the HttpClientBuilder before the client is constructed.

  • Constructor Details

    • ApacheHC5RDF4JHttpClientFactory

      public ApacheHC5RDF4JHttpClientFactory()
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface RDF4JHttpClientFactory
      Returns:
      a short identifier for this factory, e.g. "jdk" or "apache5".
    • create

      public RDF4JHttpClient create()
      Description copied from interface: RDF4JHttpClientFactory
      Creates a new RDF4JHttpClient with default configuration.
      Specified by:
      create in interface RDF4JHttpClientFactory
      Returns:
      a new client.
    • create

      public RDF4JHttpClient create(RDF4JHttpClientConfig config)
      Creates a new RDF4JHttpClient backed by an Apache HttpComponents 5 client configured from the given RDF4JHttpClientConfig.

      The HttpClientBuilder is fully configured from config before being passed to buildHttpClient(HttpClientBuilder, RDF4JHttpClientConfig). Subclasses may override that method to apply additional customization before the client is built.

      Specified by:
      create in interface RDF4JHttpClientFactory
      Parameters:
      config - the client configuration; must not be null
      Returns:
      a new RDF4JHttpClient
    • buildHttpClient

      protected org.apache.hc.client5.http.impl.classic.CloseableHttpClient buildHttpClient(org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder, RDF4JHttpClientConfig config)
      Builds the CloseableHttpClient from the supplied HttpClientBuilder.

      The builder has already been fully configured by create(RDF4JHttpClientConfig) when this method is called. Subclasses may override this method to apply additional configuration to the builder before calling super.buildHttpClient(builder, config), or to replace the build entirely.

      Parameters:
      builder - the pre-configured builder; must not be null
      config - the client configuration that was used to configure the builder; must not be null
      Returns:
      the built CloseableHttpClient