Class DefaultHttpClient.Builder

java.lang.Object
com.auth0.net.client.DefaultHttpClient.Builder
Enclosing class:
DefaultHttpClient

public static class DefaultHttpClient.Builder extends Object
Builder for DefaultHttpClient instances.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • withReadTimeout

      public DefaultHttpClient.Builder withReadTimeout(int readTimeout)
      Sets the value of the read timeout, in seconds. Defaults to ten seconds. A value of zero results in no read timeout. Negative numbers will be treated as zero.
      Parameters:
      readTimeout - the value of the read timeout to use.
      Returns:
      this builder instance.
    • withConnectTimeout

      public DefaultHttpClient.Builder withConnectTimeout(int connectTimeout)
      Sets the value of the connect timeout, in seconds. Defaults to ten seconds. A value of zero results in no connect timeout. Negative numbers will be treated as zero.
      Parameters:
      connectTimeout - the value of the connect timeout to use.
      Returns:
      this builder instance.
    • withLogging

      public DefaultHttpClient.Builder withLogging(LoggingOptions loggingOptions)
      Set the HTTP logging configuration options. If not set, no logs will be captured.
      Parameters:
      loggingOptions - the Logging configuration options.
      Returns:
      this builder instance.
    • withProxy

      public DefaultHttpClient.Builder withProxy(ProxyOptions proxyOptions)
      Configure this client for use with a proxy.
      Parameters:
      proxyOptions - the Proxy configuration options
      Returns:
      this builder instance.
    • telemetryEnabled

      public DefaultHttpClient.Builder telemetryEnabled(boolean telemetryEnabled)
      Configure this client to enable or disable sending telemetry data to Auth0 servers (on by default).
      Parameters:
      telemetryEnabled - true send telemetry data, false to not send.
      Returns:
      this builder instance.
    • withMaxRetries

      public DefaultHttpClient.Builder withMaxRetries(int maxRetries)
      Sets the maximum number of consecutive retries for API requests that fail due to rate-limits being reached. By default, rate-limited requests will be retried a maximum of three times. To disable retries on rate-limit errors, set this value to zero.
      Parameters:
      maxRetries - the maximum number of consecutive retries to attempt upon a rate-limit error. Defaults to three. Must be a number between zero (do not retry) and ten.
      Returns:
      this builder instance.
    • withMaxRequests

      public DefaultHttpClient.Builder withMaxRequests(int maxRequests)
      Sets the maximum number of requests to execute concurrently.
      Parameters:
      maxRequests - the number of requests to execute concurrently. Must be equal to or greater than one.
      Returns:
      this builder instance.
    • withMaxRequestsPerHost

      public DefaultHttpClient.Builder withMaxRequestsPerHost(int maxRequestsPerHost)
      Sets the maximum number of requests for each host to execute concurrently.
      Parameters:
      maxRequestsPerHost - the maximum number of requests for each host to execute concurrently. Must be equal to or greater than one.
      Returns:
      this builder instance.
    • build

      public DefaultHttpClient build()
      Create a DefaultHttpClient from this configured builder.
      Returns:
      the created DefaultHttpClient.