Modifier and Type | Class and Description |
---|---|
static class |
HttpClientHandler.HostnameVerifier
SSL host name verification policies.
|
static class |
HttpClientHandler.ProxyInfo
Holds the proxy configuration attributes
|
Modifier and Type | Field and Description |
---|---|
static Option<Duration> |
OPTION_CONNECT_TIMEOUT
The TCP connect timeout for new HTTP connections.
|
static Option<HttpClientHandler.HostnameVerifier> |
OPTION_HOSTNAME_VERIFIER
Specifies the SSL host name verification policy.
|
static Option<KeyManager[]> |
OPTION_KEY_MANAGERS
Specifies the list of key managers that should be used when configuring
SSL/TLS connections.
|
static Option<Loader> |
OPTION_LOADER
The strategy which should be used for loading the
HttpClientProvider . |
static Option<Integer> |
OPTION_MAX_CONNECTIONS
Specifies the maximum number of connections that should be pooled by the
HTTP client.
|
static Option<HttpClientHandler.ProxyInfo> |
OPTION_PROXY
Holds the proxy configuration attributes
|
static Option<Boolean> |
OPTION_PROXY_SYSTEM
If true and OPTION_PROXY is null, uses the system proxy settings
|
static Option<Boolean> |
OPTION_RETRY_REQUESTS
Specifies whether requests should be retried if a failure is detected.
|
static Option<Boolean> |
OPTION_REUSE_CONNECTIONS
Specifies whether HTTP connections should be kept alive an reused for
additional requests.
|
static Option<Duration> |
OPTION_SO_TIMEOUT
The TCP socket timeout when waiting for HTTP responses.
|
static Option<List<String>> |
OPTION_SSL_CIPHER_SUITES
List of JSSE ciphers to be enabled on the HttpClient.
|
static Option<List<String>> |
OPTION_SSL_ENABLED_PROTOCOLS
List of SSL protocols to be enabled on the HttpClient.
|
static Option<String> |
OPTION_SSLCONTEXT_ALGORITHM
SSLContext algorithm to be used when making SSL/TLS connections.
|
static Option<Factory<Buffer>> |
OPTION_TEMPORARY_STORAGE
Specifies the temporary storage that should be used for storing HTTP
responses.
|
static Option<TrustManager[]> |
OPTION_TRUST_MANAGERS
Specifies the list of trust managers that should be used when configuring
SSL/TLS connections.
|
Constructor and Description |
---|
HttpClientHandler()
Creates a new HTTP client using default client options.
|
HttpClientHandler(Options options)
Creates a new HTTP client using the provided client options.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Completes all pending requests and release resources associated with
underlying implementation.
|
Promise<Response,NeverThrowsException> |
handle(Context context,
Request request)
Sends an HTTP request to a remote server and returns a
Promise
representing the asynchronous response. |
public static final Option<Duration> OPTION_CONNECT_TIMEOUT
public static final Option<Duration> OPTION_SO_TIMEOUT
public static final Option<Boolean> OPTION_REUSE_CONNECTIONS
public static final Option<Boolean> OPTION_RETRY_REQUESTS
public static final Option<KeyManager[]> OPTION_KEY_MANAGERS
public static final Option<Loader> OPTION_LOADER
HttpClientProvider
. By default, the provider will be loaded using
a ServiceLoader
.Loader.SERVICE_LOADER
public static final Option<Integer> OPTION_MAX_CONNECTIONS
public static final Option<Factory<Buffer>> OPTION_TEMPORARY_STORAGE
IO.newTemporaryStorage()
is used.public static final Option<TrustManager[]> OPTION_TRUST_MANAGERS
public static final Option<HttpClientHandler.ProxyInfo> OPTION_PROXY
public static final Option<Boolean> OPTION_PROXY_SYSTEM
public static final Option<HttpClientHandler.HostnameVerifier> OPTION_HOSTNAME_VERIFIER
public static final Option<String> OPTION_SSLCONTEXT_ALGORITHM
public static final Option<List<String>> OPTION_SSL_ENABLED_PROTOCOLS
public static final Option<List<String>> OPTION_SSL_CIPHER_SUITES
public HttpClientHandler() throws HttpApplicationException
HttpApplicationException
- If no client provider could be found.public HttpClientHandler(Options options) throws HttpApplicationException
options
- The options which will be used to configure the client.HttpApplicationException
- If no client provider could be found, or if the client could
not be configured using the provided set of options.NullPointerException
- If options
was null
.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- if an I/O error occurspublic Promise<Response,NeverThrowsException> handle(Context context, Request request)
Promise
representing the asynchronous response.
Returns a 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).
A handler that doesn't hand-off the processing to another downstream handler is responsible for creating the response.
The returned Promise
contains the response returned from the server as-is.
This is responsibility of the handler to produce the appropriate error response (404,
500, ...) in case of processing error.
Note: As of Promise 2.0 implementation, it is not permitted to throw any runtime exception here. Doing so produce unexpected behaviour (most likely a server-side hang of the processing thread).
Copyright © 2025 Open Identity Platform Community. All rights reserved.