Package org.openqa.selenium.remote.http
Interface HttpClient
- All Superinterfaces:
AutoCloseable,Closeable,HttpHandler
- All Known Implementing Classes:
JdkHttpClient,TracedHttpClient
Defines a simple client for making HTTP requests.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()default CompletableFuture<HttpResponse> executeAsync(HttpRequest req) openSocket(HttpRequest request, WebSocket.Listener listener) <T> CompletableFuture<HttpResponse<T>> sendAsyncNative(HttpRequest request, HttpResponse.BodyHandler<T> handler) Sends an HTTP request using java.net.http.HttpClient and allows specifying the BodyHandler.<T> HttpResponse<T> sendNative(HttpRequest request, HttpResponse.BodyHandler<T> handler) Sends an HTTP request using java.net.http.HttpClient and allows specifying the BodyHandler.Methods inherited from interface org.openqa.selenium.remote.http.HttpHandler
execute, with
-
Method Details
-
openSocket
-
executeAsync
-
close
default void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
sendAsyncNative
<T> CompletableFuture<HttpResponse<T>> sendAsyncNative(HttpRequest request, HttpResponse.BodyHandler<T> handler) Sends an HTTP request using java.net.http.HttpClient and allows specifying the BodyHandler.- Type Parameters:
T- the response body type- Parameters:
request- the HTTP request to sendhandler- the BodyHandler that determines how to handle the response body- Returns:
- a CompletableFuture containing the HTTP response
-
sendNative
<T> HttpResponse<T> sendNative(HttpRequest request, HttpResponse.BodyHandler<T> handler) throws IOException, InterruptedException Sends an HTTP request using java.net.http.HttpClient and allows specifying the BodyHandler.- Type Parameters:
T- the response body type- Parameters:
request- the HTTP request to sendhandler- the BodyHandler that determines how to handle the response body- Returns:
- the HTTP response
- Throws:
IOException- if an I/O error occursInterruptedException- if the operation is interrupted
-