Class JettyHttpTransportBuilder

java.lang.Object
org.apache.juneau.rest.client.jetty.JettyHttpTransportBuilder

public final class JettyHttpTransportBuilder extends Object
Fluent builder for JettyHttpTransport.

Obtain an instance via JettyHttpTransport.builder().

See Also:
Since:
9.2.1
  • Method Details

    • httpClient

      public JettyHttpTransportBuilder httpClient(org.eclipse.jetty.client.HttpClient value)
      Sets the underlying HttpClient to use.

      If not set, a default client is created via new HttpClient().

      If the provided client has not been started, JettyHttpTransport will start it automatically. When JettyHttpTransport.close() is called, the client will be stopped.

      The client itself is not changed. So that a redirect it follows does not carry caller-set credential headers to another origin, the transport creates each request itself, as a guarded subclass of Jetty's request, instead of calling HttpClient.newRequest(java.net.URI); an override of that method is not called. Customize requests with the client's own settings and request listeners instead.

      Parameters:
      value - The client to use. Must not be null.
      Returns:
      This object.
    • responseTimeoutMs

      Sets the maximum time to wait for the response headers to arrive after the request is sent.

      This timeout covers the time from when the request is fully sent until the first response line and headers are received. It does not limit how long the response body may take to stream. Defaults to 30_000 ms (30 seconds).

      Parameters:
      value - The timeout in milliseconds. Use 0 or a negative value to wait indefinitely.
      Returns:
      This object.
    • build

      Builds and returns the JettyHttpTransport.
      Returns:
      A new instance. Never null.
      Throws:
      Exception - If the Jetty HttpClient cannot be started.