Class ApacheHc45TransportBuilder

java.lang.Object
org.apache.juneau.rest.client.apachehttpclient45.ApacheHc45TransportBuilder

public final class ApacheHc45TransportBuilder extends Object
Fluent builder for ApacheHc45Transport.

Obtain an instance via ApacheHc45Transport.builder().

See Also:
Since:
9.2.1
  • Method Details

    • httpClient

      Sets the underlying CloseableHttpClient to use.

      If not set, the transport creates its own default clients: one for ordinary requests, and one with a separate connection pool whose connections are all pinned to a policy-allowed address, for SSRF-guard-active @Remote requests.

      A caller-supplied client cannot be given that pin-on-connect pool, so a transport built with one reports ApacheHc45Transport.supportsUrlPolicy() as false, and RestRequest refuses to send an SSRF-guard-active request through it.

      The transport takes ownership of the client and will close it when ApacheHc45Transport.close() is called.

      A legacy AbstractHttpClient subclass (such as DefaultHttpClient) is refused: it never sets the request again just before it is written, so the redirect credential guard cannot strip the credentials HttpClient adds itself (for example the cookie-store Cookie) on a cross-origin redirect. Build the client with HttpClients.

      Parameters:
      value - The client to use. Must not be null.
      Returns:
      This object.
      Throws:
      IllegalArgumentException - If the client is an AbstractHttpClient.
    • build

      Builds and returns the ApacheHc45Transport.
      Returns:
      A new instance. Never null.