public interface HttpClient extends AutoCloseable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
HttpClient.AsyncBody
A simplified java.util.concurrent.Flow.Subscription and a future tracking done.
|
static interface |
HttpClient.BodyConsumer<T>
A functional interface for consuming async result bodies
|
static interface |
HttpClient.Builder |
static interface |
HttpClient.DerivedClientBuilder |
static interface |
HttpClient.Factory |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
CompletableFuture<HttpResponse<HttpClient.AsyncBody>> |
consumeBytes(HttpRequest request,
HttpClient.BodyConsumer<List<ByteBuffer>> consumer)
Send a request and consume the bytes of the resulting response body
|
CompletableFuture<HttpResponse<HttpClient.AsyncBody>> |
consumeLines(HttpRequest request,
HttpClient.BodyConsumer<String> consumer)
Send a request and consume the lines of the response body using the same logic as
BufferedReader to
break up the lines. |
HttpClient.Factory |
getFactory() |
HttpClient.DerivedClientBuilder |
newBuilder()
Create a builder that starts with the same state as this client.
|
HttpRequest.Builder |
newHttpRequestBuilder() |
WebSocket.Builder |
newWebSocketBuilder() |
<T> CompletableFuture<HttpResponse<T>> |
sendAsync(HttpRequest request,
Class<T> type)
Send an async request
A Reader or InputStream result must be closed by the caller to properly cleanup resources. |
void close()
close in interface AutoCloseableHttpClient.DerivedClientBuilder newBuilder()
<T> CompletableFuture<HttpResponse<T>> sendAsync(HttpRequest request, Class<T> type)
T - return typerequest - the HttpRequest to send asynchronouslytype - one of InputStream, Reader, String, byte[]CompletableFuture<HttpResponse<HttpClient.AsyncBody>> consumeLines(HttpRequest request, HttpClient.BodyConsumer<String> consumer)
BufferedReader to
break up the lines.request - the HttpRequest to sendconsumer - the response body consumerCompletableFuture<HttpResponse<HttpClient.AsyncBody>> consumeBytes(HttpRequest request, HttpClient.BodyConsumer<List<ByteBuffer>> consumer)
request - the HttpRequest to sendconsumer - the response body consumerWebSocket.Builder newWebSocketBuilder()
HttpRequest.Builder newHttpRequestBuilder()
HttpClient.Factory getFactory()
Copyright © 2015–2022 Red Hat. All rights reserved.