public class HTTPClient extends java.lang.Object implements RESTClient
This class provides functionality for making HTTP requests to a REST API and processing the corresponding responses. It supports common HTTP methods like GET, POST, PUT, DELETE, and HEAD. Additionally, it allows handling server error responses using a custom error handler.
Referred from core/src/main/java/org/apache/iceberg/rest/HTTPClient.java
| Modifier and Type | Class and Description | 
|---|---|
| static class  | HTTPClient.BuilderBuilder class for configuring and creating instances of HTTPClient. | 
| Modifier and Type | Method and Description | 
|---|---|
| static HTTPClient.Builder | builder(java.util.Map<java.lang.String,java.lang.String> properties)Creates a new instance of the HTTPClient.Builder with the specified properties. | 
| void | close()Closes the underlying HTTP client gracefully. | 
| <T extends RESTResponse> | delete(java.lang.String path,
      java.lang.Class<T> responseType,
      java.util.Map<java.lang.String,java.lang.String> headers,
      java.util.function.Consumer<ErrorResponse> errorHandler)Sends an HTTP DELETE request to the specified path without query parameters and processes the
 response. | 
| <T extends RESTResponse> | delete(java.lang.String path,
      java.util.Map<java.lang.String,java.lang.String> queryParams,
      java.lang.Class<T> responseType,
      java.util.Map<java.lang.String,java.lang.String> headers,
      java.util.function.Consumer<ErrorResponse> errorHandler)Sends an HTTP DELETE request to the specified path with the provided query parameters and
 processes the response. | 
| <T extends RESTResponse> | get(java.lang.String path,
   java.util.Map<java.lang.String,java.lang.String> queryParams,
   java.lang.Class<T> responseType,
   java.util.Map<java.lang.String,java.lang.String> headers,
   java.util.function.Consumer<ErrorResponse> errorHandler)Sends an HTTP GET request to the specified path and processes the response. | 
| void | head(java.lang.String path,
    java.util.Map<java.lang.String,java.lang.String> headers,
    java.util.function.Consumer<ErrorResponse> errorHandler)Sends an HTTP HEAD request to the specified path and processes the response. | 
| <T extends RESTResponse> | patch(java.lang.String path,
     RESTRequest body,
     java.lang.Class<T> responseType,
     java.util.Map<java.lang.String,java.lang.String> headers,
     java.util.function.Consumer<ErrorResponse> errorHandler)Sends an HTTP PATCH request to the specified path with the provided request body and processes
 the response with support for response headers. | 
| <T extends RESTResponse> | post(java.lang.String path,
    RESTRequest body,
    java.lang.Class<T> responseType,
    java.util.Map<java.lang.String,java.lang.String> headers,
    java.util.function.Consumer<ErrorResponse> errorHandler)Sends an HTTP POST request to the specified path with the provided request body and processes
 the response. | 
| <T extends RESTResponse> | post(java.lang.String path,
    RESTRequest body,
    java.lang.Class<T> responseType,
    java.util.Map<java.lang.String,java.lang.String> headers,
    java.util.function.Consumer<ErrorResponse> errorHandler,
    java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.String>> responseHeaders)Sends an HTTP POST request to the specified path with the provided request body and processes
 the response with support for response headers. | 
| <T extends RESTResponse> | postForm(java.lang.String path,
        java.util.Map<java.lang.String,java.lang.String> formData,
        java.lang.Class<T> responseType,
        java.util.Map<java.lang.String,java.lang.String> headers,
        java.util.function.Consumer<ErrorResponse> errorHandler)Sends an HTTP POST request with form data to the specified path and processes the response. | 
| <T extends RESTResponse> | put(java.lang.String path,
   RESTRequest body,
   java.lang.Class<T> responseType,
   java.util.Map<java.lang.String,java.lang.String> headers,
   java.util.function.Consumer<ErrorResponse> errorHandler)Sends an HTTP PUT request to the specified path with the provided request body and processes
 the response. | 
| <T extends RESTResponse> | put(java.lang.String path,
   RESTRequest body,
   java.lang.Class<T> responseType,
   java.util.Map<java.lang.String,java.lang.String> headers,
   java.util.function.Consumer<ErrorResponse> errorHandler,
   java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.String>> responseHeaders)Sends an HTTP PUT request to the specified path with the provided request body and processes
 the response with support for response headers. | 
public void head(java.lang.String path,
                 java.util.Map<java.lang.String,java.lang.String> headers,
                 java.util.function.Consumer<ErrorResponse> errorHandler)
head in interface RESTClientpath - The URL path to send the HEAD request to.headers - A map of request headers (key-value pairs) to include in the request (can be
     null).errorHandler - The error handler delegated for HTTP responses, which handles server error
     responses.public <T extends RESTResponse> T get(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> queryParams, java.lang.Class<T> responseType, java.util.Map<java.lang.String,java.lang.String> headers, java.util.function.Consumer<ErrorResponse> errorHandler)
get in interface RESTClientT - The class type of the response for deserialization.path - The URL path to send the GET request to.queryParams - A map of query parameters (key-value pairs) to include in the request URL
     (can be null).responseType - The class type of the response for deserialization (Must be registered with
     the ObjectMapper).headers - A map of request headers (key-value pairs) to include in the request (can be
     null).errorHandler - The error handler delegated for HTTP responses, which handles server error
     responses.public <T extends RESTResponse> T post(java.lang.String path, RESTRequest body, java.lang.Class<T> responseType, java.util.Map<java.lang.String,java.lang.String> headers, java.util.function.Consumer<ErrorResponse> errorHandler)
post in interface RESTClientT - The class type of the response for deserialization.path - The URL path to send the POST request to.body - The REST body to place in the request body.responseType - The class type of the response for deserialization (Must be registered with
     the ObjectMapper).headers - A map of request headers (key-value pairs) to include in the request (can be
     null).errorHandler - The error handler delegated for HTTP responses, which handles server error
     responses.public <T extends RESTResponse> T post(java.lang.String path, RESTRequest body, java.lang.Class<T> responseType, java.util.Map<java.lang.String,java.lang.String> headers, java.util.function.Consumer<ErrorResponse> errorHandler, java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.String>> responseHeaders)
post in interface RESTClientT - The class type of the response for deserialization.path - The URL path to send the POST request to.body - The REST request to place in the request body.responseType - The class type of the response for deserialization (Must be registered with
     the ObjectMapper).headers - A map of request headers (key-value pairs) to include in the request (can be
     null).errorHandler - The error handler delegated for HTTP responses, which handles server error
     responses.responseHeaders - The consumer of the response headers for further processing.public <T extends RESTResponse> T put(java.lang.String path, RESTRequest body, java.lang.Class<T> responseType, java.util.Map<java.lang.String,java.lang.String> headers, java.util.function.Consumer<ErrorResponse> errorHandler)
put in interface RESTClientT - The class type of the response for deserialization.path - The URL path to send the PUT request to.body - The REST request to place in the request body.responseType - The class type of the response for deserialization (Must be registered with
     the ObjectMapper).headers - A map of request headers (key-value pairs) to include in the request (can be
     null).errorHandler - The error handler delegated for HTTP responses, which handles server error
     responses.public <T extends RESTResponse> T put(java.lang.String path, RESTRequest body, java.lang.Class<T> responseType, java.util.Map<java.lang.String,java.lang.String> headers, java.util.function.Consumer<ErrorResponse> errorHandler, java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.String>> responseHeaders)
put in interface RESTClientT - The class type of the response for deserialization.path - The URL path to send the PUT request to.body - The REST request to place in the request body.responseType - The class type of the response for deserialization (Must be registered with
     the ObjectMapper).headers - A map of request headers (key-value pairs) to include in the request (can be
     null).errorHandler - The error handler delegated for HTTP responses, which handles server error
     responses.responseHeaders - The consumer of the response headers for further processing.public <T extends RESTResponse> T patch(java.lang.String path, RESTRequest body, java.lang.Class<T> responseType, java.util.Map<java.lang.String,java.lang.String> headers, java.util.function.Consumer<ErrorResponse> errorHandler)
patch in interface RESTClientT - The class type of the response for deserialization.path - The URL path to send the PATCH request to.body - The REST request to place in the request body.responseType - The class type of the response for deserialization (Must be registered with
     the ObjectMapper).headers - A map of request headers (key-value pairs) to include in the request (can be
     null).errorHandler - The error handler delegated for HTTP responses, which handles server error
     responses.public <T extends RESTResponse> T delete(java.lang.String path, java.lang.Class<T> responseType, java.util.Map<java.lang.String,java.lang.String> headers, java.util.function.Consumer<ErrorResponse> errorHandler)
delete in interface RESTClientT - The class type of the response for deserialization.path - The URL path to send the DELETE request to.responseType - The class type of the response for deserialization (Must be registered with
     the ObjectMapper).headers - A map of request headers (key-value pairs) to include in the request (can be
     null).errorHandler - The error handler delegated for HTTP responses, which handles server error
     responses.public <T extends RESTResponse> T delete(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> queryParams, java.lang.Class<T> responseType, java.util.Map<java.lang.String,java.lang.String> headers, java.util.function.Consumer<ErrorResponse> errorHandler)
delete in interface RESTClientT - The class type of the response for deserialization.path - The URL path to send the DELETE request to.queryParams - A map of query parameters (key-value pairs) to include in the request (can
     be null).responseType - The class type of the response for deserialization (Must be registered with
     the ObjectMapper).headers - A map of request headers (key-value pairs) to include in the request (can be
     null).errorHandler - The error handler delegated for HTTP responses, which handles server error
     responses.public <T extends RESTResponse> T postForm(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> formData, java.lang.Class<T> responseType, java.util.Map<java.lang.String,java.lang.String> headers, java.util.function.Consumer<ErrorResponse> errorHandler)
postForm in interface RESTClientT - The class type of the response for deserialization.path - The URL path to send the POST request to.formData - A map of form data (key-value pairs) to include in the request body.responseType - The class type of the response for deserialization (Must be registered with
     the ObjectMapper).headers - A map of request headers (key-value pairs) to include in the request (can be
     null).errorHandler - The error handler delegated for HTTP responses, which handles server error
     responses.public void close()
           throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException - If an I/O error occurs while closing the HTTP client.public static HTTPClient.Builder builder(java.util.Map<java.lang.String,java.lang.String> properties)
properties - A map of properties (key-value pairs) used to configure the HTTP client.