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