Package com.auth0.net.client
Class DefaultHttpClient.Builder
java.lang.Object
com.auth0.net.client.DefaultHttpClient.Builder
- Enclosing class:
- DefaultHttpClient
Builder for
DefaultHttpClient instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Create aDefaultHttpClientfrom this configured builder.telemetryEnabled(boolean telemetryEnabled) Configure this client to enable or disable sending telemetry data to Auth0 servers (on by default).withConnectTimeout(int connectTimeout) Sets the value of the connect timeout, in seconds.withLogging(LoggingOptions loggingOptions) Set the HTTP logging configuration options.withMaxRequests(int maxRequests) Sets the maximum number of requests to execute concurrently.withMaxRequestsPerHost(int maxRequestsPerHost) Sets the maximum number of requests for each host to execute concurrently.withMaxRetries(int maxRetries) Sets the maximum number of consecutive retries for API requests that fail due to rate-limits being reached.withProxy(ProxyOptions proxyOptions) Configure this client for use with a proxy.withReadTimeout(int readTimeout) Sets the value of the read timeout, in seconds.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withReadTimeout
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
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
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
Configure this client for use with a proxy.- Parameters:
proxyOptions- the Proxy configuration options- Returns:
- this builder instance.
-
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
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
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
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
Create aDefaultHttpClientfrom this configured builder.- Returns:
- the created
DefaultHttpClient.
-