Package org.apache.iceberg.rest
Class BaseHTTPClient
java.lang.Object
org.apache.iceberg.rest.BaseHTTPClient
- All Implemented Interfaces:
Closeable
,AutoCloseable
,RESTClient
- Direct Known Subclasses:
HTTPClient
A base class for
RESTClient
implementations.
All methods in RESTClient
are implemented in the same way: first, an HTTPRequest
is built from the
method arguments, then executed.
This allows subclasses to provide a consistent way to execute all requests, regardless of the method or arguments.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract HTTPRequest
buildRequest
(HTTPRequest.HTTPMethod method, String path, Map<String, String> queryParams, Map<String, String> headers, Object body) <T extends RESTResponse>
Tdelete
(String path, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler) <T extends RESTResponse>
Tdelete
(String path, Map<String, String> queryParams, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler) protected abstract <T extends RESTResponse>
Texecute
(HTTPRequest request, Class<T> responseType, Consumer<ErrorResponse> errorHandler, Consumer<Map<String, String>> responseHeaders) <T extends RESTResponse>
Tget
(String path, Map<String, String> queryParams, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler) void
<T extends RESTResponse>
Tpost
(String path, RESTRequest body, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler) <T extends RESTResponse>
Tpost
(String path, RESTRequest body, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler, Consumer<Map<String, String>> responseHeaders) <T extends RESTResponse>
TpostForm
(String path, Map<String, String> formData, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler) abstract RESTClient
withAuthSession
(AuthSession session) Returns a REST client that authenticates requests using the given session.
-
Constructor Details
-
BaseHTTPClient
public BaseHTTPClient()
-
-
Method Details
-
withAuthSession
Description copied from interface:RESTClient
Returns a REST client that authenticates requests using the given session.- Specified by:
withAuthSession
in interfaceRESTClient
-
head
- Specified by:
head
in interfaceRESTClient
-
delete
public <T extends RESTResponse> T delete(String path, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler) - Specified by:
delete
in interfaceRESTClient
-
delete
public <T extends RESTResponse> T delete(String path, Map<String, String> queryParams, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler) - Specified by:
delete
in interfaceRESTClient
-
get
public <T extends RESTResponse> T get(String path, Map<String, String> queryParams, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler) - Specified by:
get
in interfaceRESTClient
-
post
public <T extends RESTResponse> T post(String path, RESTRequest body, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler) - Specified by:
post
in interfaceRESTClient
-
post
public <T extends RESTResponse> T post(String path, RESTRequest body, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler, Consumer<Map<String, String>> responseHeaders) - Specified by:
post
in interfaceRESTClient
-
postForm
public <T extends RESTResponse> T postForm(String path, Map<String, String> formData, Class<T> responseType, Map<String, String> headers, Consumer<ErrorResponse> errorHandler) - Specified by:
postForm
in interfaceRESTClient
-
buildRequest
protected abstract HTTPRequest buildRequest(HTTPRequest.HTTPMethod method, String path, Map<String, String> queryParams, Map<String, String> headers, Object body) -
execute
protected abstract <T extends RESTResponse> T execute(HTTPRequest request, Class<T> responseType, Consumer<ErrorResponse> errorHandler, Consumer<Map<String, String>> responseHeaders)
-