Package org.projectnessie.client.http
Class HttpClientBuilder
- java.lang.Object
-
- org.projectnessie.client.http.HttpClientBuilder
-
- All Implemented Interfaces:
NessieClientBuilder<HttpClientBuilder>
public class HttpClientBuilder extends java.lang.Object implements NessieClientBuilder<HttpClientBuilder>
A builder class that creates aNessieHttpClientviabuilder().
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringENABLE_API_COMPATIBILITY_CHECK_SYSTEM_PROPERTY
-
Constructor Summary
Constructors Modifier Constructor Description protectedHttpClientBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <API extends NessieApi>
APIbuild(java.lang.Class<API> apiVersion)Builds a newNessieApi.static HttpClientBuilderbuilder()HttpClientBuilderfromConfig(java.util.function.Function<java.lang.String,java.lang.String> configuration)Configure this HttpClientBuilder instance using a configuration object and standard Nessie configuration keys defined by the constants defined inNessieConfigConstants.HttpClientBuilderfromSystemProperties()Same semantics asfromConfig(Function), uses the system properties.HttpClientBuilderwithAuthentication(NessieAuthentication authentication)Sets theNessieAuthenticationinstance to be used.HttpClientBuilderwithAuthenticationFromConfig(java.util.function.Function<java.lang.String,java.lang.String> configuration)Configure only authentication in this HttpClientBuilder instance using a configuration object and standard Nessie configuration keys defined by the constants defined inNessieConfigConstants.HttpClientBuilderwithConnectionTimeout(int connectionTimeoutMillis)Set the connection timeout in milliseconds for this client.HttpClientBuilderwithDisableCompression(boolean disableCompression)Set whether the compression shall be disabled or not.HttpClientBuilderwithEnableApiCompatibilityCheck(boolean enable)HttpClientBuilderwithFollowRedirects(java.lang.String redirects)HttpClientBuilderwithForceUrlConnectionClient(boolean forceUrlConnectionClient)HttpClientBuilderwithHttp2Upgrade(boolean http2Upgrade)HttpClientBuilderwithReadTimeout(int readTimeoutMillis)Set the read timeout in milliseconds for this client.HttpClientBuilderwithResponseFactory(HttpResponseFactory responseFactory)HttpClientBuilderwithSSLContext(javax.net.ssl.SSLContext sslContext)Set the SSL context for this client.HttpClientBuilderwithSSLParameters(javax.net.ssl.SSLParameters sslParameters)HttpClientBuilderwithTracing(boolean tracing)Whether to enable adding the HTTP headers of an active OpenTracing span to all Nessie requests.HttpClientBuilderwithUri(java.net.URI uri)Set the Nessie server URI.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.projectnessie.client.NessieClientBuilder
withUri
-
-
-
-
Field Detail
-
ENABLE_API_COMPATIBILITY_CHECK_SYSTEM_PROPERTY
public static final java.lang.String ENABLE_API_COMPATIBILITY_CHECK_SYSTEM_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
builder
public static HttpClientBuilder builder()
-
fromSystemProperties
public HttpClientBuilder fromSystemProperties()
Same semantics asfromConfig(Function), uses the system properties.- Specified by:
fromSystemPropertiesin interfaceNessieClientBuilder<HttpClientBuilder>- Returns:
this- See Also:
fromConfig(Function)
-
fromConfig
public HttpClientBuilder fromConfig(java.util.function.Function<java.lang.String,java.lang.String> configuration)
Configure this HttpClientBuilder instance using a configuration object and standard Nessie configuration keys defined by the constants defined inNessieConfigConstants. Non-nullvalues returned by theconfiguration-function will override previously configured values.- Specified by:
fromConfigin interfaceNessieClientBuilder<HttpClientBuilder>- Parameters:
configuration- The function that returns a configuration value for a configuration key.- Returns:
this- See Also:
fromSystemProperties()
-
withAuthenticationFromConfig
@CanIgnoreReturnValue public HttpClientBuilder withAuthenticationFromConfig(java.util.function.Function<java.lang.String,java.lang.String> configuration)
Configure only authentication in this HttpClientBuilder instance using a configuration object and standard Nessie configuration keys defined by the constants defined inNessieConfigConstants.- Specified by:
withAuthenticationFromConfigin interfaceNessieClientBuilder<HttpClientBuilder>- Parameters:
configuration- The function that returns a configuration value for a configuration key.- Returns:
this- See Also:
fromConfig(Function)
-
withUri
@CanIgnoreReturnValue public HttpClientBuilder withUri(java.net.URI uri)
Set the Nessie server URI. A server URI must be configured.- Specified by:
withUriin interfaceNessieClientBuilder<HttpClientBuilder>- Parameters:
uri- server URI- Returns:
this
-
withAuthentication
@CanIgnoreReturnValue public HttpClientBuilder withAuthentication(NessieAuthentication authentication)
Description copied from interface:NessieClientBuilderSets theNessieAuthenticationinstance to be used.- Specified by:
withAuthenticationin interfaceNessieClientBuilder<HttpClientBuilder>- Parameters:
authentication- authentication for this client- Returns:
this
-
withTracing
@CanIgnoreReturnValue public HttpClientBuilder withTracing(boolean tracing)
Whether to enable adding the HTTP headers of an active OpenTracing span to all Nessie requests. If enabled, the OpenTracing dependencies must be present at runtime.- Parameters:
tracing-trueto enable passing HTTP headers for active tracing spans.- Returns:
this
-
withReadTimeout
@CanIgnoreReturnValue public HttpClientBuilder withReadTimeout(int readTimeoutMillis)
Set the read timeout in milliseconds for this client. Timeout will throwHttpClientReadTimeoutException.- Parameters:
readTimeoutMillis- number of seconds to wait for a response from server.- Returns:
this
-
withConnectionTimeout
@CanIgnoreReturnValue public HttpClientBuilder withConnectionTimeout(int connectionTimeoutMillis)
Set the connection timeout in milliseconds for this client. Timeout will throwHttpClientException.- Parameters:
connectionTimeoutMillis- number of seconds to wait to connect to the server.- Returns:
this
-
withDisableCompression
@CanIgnoreReturnValue public HttpClientBuilder withDisableCompression(boolean disableCompression)
Set whether the compression shall be disabled or not.- Parameters:
disableCompression- whether the compression shall be disabled or not.- Returns:
this
-
withSSLContext
@CanIgnoreReturnValue public HttpClientBuilder withSSLContext(javax.net.ssl.SSLContext sslContext)
Set the SSL context for this client.- Parameters:
sslContext- the SSL context to use- Returns:
this
-
withSSLParameters
@CanIgnoreReturnValue public HttpClientBuilder withSSLParameters(javax.net.ssl.SSLParameters sslParameters)
-
withHttp2Upgrade
@CanIgnoreReturnValue public HttpClientBuilder withHttp2Upgrade(boolean http2Upgrade)
-
withFollowRedirects
@CanIgnoreReturnValue public HttpClientBuilder withFollowRedirects(java.lang.String redirects)
-
withForceUrlConnectionClient
@CanIgnoreReturnValue public HttpClientBuilder withForceUrlConnectionClient(boolean forceUrlConnectionClient)
-
withEnableApiCompatibilityCheck
@CanIgnoreReturnValue public HttpClientBuilder withEnableApiCompatibilityCheck(boolean enable)
-
withResponseFactory
@CanIgnoreReturnValue public HttpClientBuilder withResponseFactory(HttpResponseFactory responseFactory)
-
build
public <API extends NessieApi> API build(java.lang.Class<API> apiVersion)
Description copied from interface:NessieClientBuilderBuilds a newNessieApi.- Specified by:
buildin interfaceNessieClientBuilder<HttpClientBuilder>- Returns:
- A new
NessieApi.
-
-