public interface HttpClient extends AutoCloseable
Modifier and Type | Interface and Description |
---|---|
static interface |
HttpClient.Builder |
static interface |
HttpClient.DerivedClientBuilder |
static interface |
HttpClient.Factory |
static class |
HttpClient.ProxyType |
Modifier and Type | Method and Description |
---|---|
void |
close() |
CompletableFuture<HttpResponse<AsyncBody>> |
consumeBytes(HttpRequest request,
AsyncBody.Consumer<List<ByteBuffer>> consumer)
Send a request and consume the bytes of the resulting response body
|
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 AutoCloseable
HttpClient.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<AsyncBody>> consumeBytes(HttpRequest request, AsyncBody.Consumer<List<ByteBuffer>> consumer)
HtttpClient implementations will provide ByteBuffers that may be held directly.
request
- the HttpRequest to sendconsumer
- the response body consumerWebSocket.Builder newWebSocketBuilder()
HttpRequest.Builder newHttpRequestBuilder()
Copyright © 2015–2023 Red Hat. All rights reserved.