public interface HttpClient extends Closeable
Client implementations. A
HttpClientProvider is loaded during construction of a new HTTP
Client. The first available provider is
selected and its HttpClientProvider.newHttpClient(org.forgerock.util.Options) method
invoked in order to construct and configure a new HttpClient.
It is the responsibility of the caller to close
the request and response messages.
HttpClient client = ...
try (Response response = client.sendAsync(...).getOrThrowUninterruptibly()) {
// consumes the response completely
}
Note: Callers should not use try-with-resources pattern if they forward the
response asynchronously (using a Promise for instance): the message
would be emptied before the callbacks are applied.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Completes all pending requests and release resources associated with
underlying implementation.
|
Promise<Response,NeverThrowsException> |
sendAsync(Request request)
|
Promise<Response,NeverThrowsException> sendAsync(Request request)
Promise representing the asynchronous Response of the given request.
If any (asynchronous) processing goes wrong, the promise still contains a Response (probably from the
4xx or 5xx status code family).
The returned Promise contains the response returned from the server as-is.
This is responsibility of the client to produce the appropriate error response (404,
500, ...) in case of processing or transport errors.
request - The HTTP request to send.void close()
throws IOException
close in interface AutoCloseableclose in interface CloseableIOException - if an I/O error occursCopyright © 2025 Open Identity Platform Community. All rights reserved.