Package org.apache.gravitino.client
Class HTTPClient.Builder
java.lang.Object
org.apache.gravitino.client.HTTPClient.Builder
- Enclosing class:
- HTTPClient
Builder class for configuring and creating instances of HTTPClient.
This class allows for setting various configuration options for the HTTP client such as base URI, request headers, and ObjectMapper.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and returns an instance of the HTTPClient with the configured options.Sets the base URI for the HTTP client.withAuthDataProvider(org.apache.gravitino.client.AuthDataProvider authDataProvider) Sets the AuthDataProvider for the HTTP client.withHeader(String key, String value) Adds a single request header to the HTTP client.withHeaders(Map<String, String> headers) Adds multiple request headers to the HTTP client.withObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Sets the custom ObjectMapper for the HTTP client.withPreConnectHandler(Runnable beforeConnectHandler) Sets the preConnect handle for the HTTP client.
-
Method Details
-
uri
Sets the base URI for the HTTP client.- Parameters:
baseUri- The base URI to be used for all HTTP requests.- Returns:
- This Builder instance for method chaining.
-
withHeader
Adds a single request header to the HTTP client.- Parameters:
key- The header name.value- The header value.- Returns:
- This Builder instance for method chaining.
-
withHeaders
Adds multiple request headers to the HTTP client.- Parameters:
headers- A map of request headers (key-value pairs) to be included in all HTTP requests.- Returns:
- This Builder instance for method chaining.
-
withObjectMapper
public HTTPClient.Builder withObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Sets the custom ObjectMapper for the HTTP client.- Parameters:
objectMapper- The custom ObjectMapper to be used for request/response serialization.- Returns:
- This Builder instance for method chaining.
-
withPreConnectHandler
Sets the preConnect handle for the HTTP client.- Parameters:
beforeConnectHandler- The handle run before connect to the server .- Returns:
- This Builder instance for method chaining.
-
withAuthDataProvider
public HTTPClient.Builder withAuthDataProvider(org.apache.gravitino.client.AuthDataProvider authDataProvider) Sets the AuthDataProvider for the HTTP client.- Parameters:
authDataProvider- The authDataProvider providing the data used to authenticate.- Returns:
- This Builder instance for method chaining.
-
build
Builds and returns an instance of the HTTPClient with the configured options.- Returns:
- An instance of HTTPClient with the configured options.
-