Package land.oras.auth
Class HttpClient.Builder
java.lang.Object
land.oras.auth.HttpClient.Builder
- Enclosing class:
- HttpClient
Builder for the HTTP client
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the clientstatic HttpClient.Builderbuilder()Build the clientwithCaContent(String caContent) Set the CA certificates from PEM-encoded contentwithCaFile(String caFilePath) Set the CA file for TLS verificationwithCaFile(Path caFilePath) Set the CA file for TLS verificationwithMaxRetries(int maxRetries) Set the maximum number of attempts for retryable requests (default: 3).withMaxRetryDelay(long maxRetryDelayMs) Set the upper bound on retry delay in milliseconds (default: 30 000).withMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Set the meter registry for metrics.withRetryDelay(long retryDelayMs) Set the initial delay before the first retry in milliseconds (default: 500).withSkipTlsVerify(boolean skipTlsVerify) Skip the TLS verificationwithTimeout(@Nullable Integer timeout) Set the timeout
-
Method Details
-
withTimeout
Set the timeout- Parameters:
timeout- The timeout in seconds- Returns:
- The builder
-
withSkipTlsVerify
Skip the TLS verification- Parameters:
skipTlsVerify- Skip TLS verification- Returns:
- The builder
-
withMeterRegistry
public HttpClient.Builder withMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Set the meter registry for metrics. Following Micrometer best practices for libraries,- Parameters:
meterRegistry- The meter registry- Returns:
- The builder
-
withMaxRetries
Set the maximum number of attempts for retryable requests (default: 3). A value of 1 disables retries entirely.- Parameters:
maxRetries- Maximum attempts (must be >= 1)- Returns:
- The builder
-
withRetryDelay
Set the initial delay before the first retry in milliseconds (default: 500). Subsequent delays are doubled up towithMaxRetryDelay(long).- Parameters:
retryDelayMs- Initial delay in milliseconds (must be >= 0)- Returns:
- The builder
-
withMaxRetryDelay
Set the upper bound on retry delay in milliseconds (default: 30 000).- Parameters:
maxRetryDelayMs- Maximum delay cap in milliseconds (must be >= 0)- Returns:
- The builder
-
withCaFile
Set the CA file for TLS verification- Parameters:
caFilePath- The path to a PEM-encoded CA certificate or bundle- Returns:
- The builder
-
withCaFile
Set the CA file for TLS verification- Parameters:
caFilePath- The path to a PEM-encoded CA certificate or bundle- Returns:
- The builder
-
withCaContent
Set the CA certificates from PEM-encoded content- Parameters:
caContent- The PEM-encoded CA certificate or bundle content- Returns:
- The builder
-
builder
Build the client- Returns:
- The client
-
build
Build the client- Returns:
- The client
-