public class ClientHandler extends Object implements Handler
HttpClient
.
{
"name": "ClientHandler",
"type": "ClientHandler",
"config": {
"connections": 64,
"disableReuseConnection": true,
"disableRetries": true,
"hostnameVerifier": "ALLOW_ALL",
"sslContextAlgorithm": "TLS",
"soTimeout": "10 seconds",
"connectionTimeout": "10 seconds",
"numberOfWorkers": 6,
"keyManager": [ "RefToKeyManager", ... ],
"trustManager": [ "RefToTrustManager", ... ],
"sslEnabledProtocols": [ "SSLv2", ... ],
"sslCipherSuites": [ "TLS_DH_anon_WITH_AES_256_CBC_SHA256", ... ],
"temporaryStorage": {reference to or inline declaration of a TemporaryStorage}
}
}
Note: This implementation does not verify hostnames for
outgoing SSL connections by default. This is because the gateway will usually access the
SSL endpoint using a raw IP address rather than a fully-qualified hostname.
KeyManager
(and TrustManager
respectively). They support singleton value (use a single
reference) as well as multi-valued references (a list):
"keyManager": "SingleKeyManagerReference",
"trustManager": [ "RefOne", "RefTwo" ]
The soTimeout optional attribute specifies a socket timeout (the given amount of time a connection
will live before being considered a stalled and automatically destroyed). It defaults to 10 seconds.
The numberOfWorkers optional attribute specifies the number of threads dedicated to process outgoing requests. It defaults to the number of CPUs available to the JVM. This attribute is only used if an asynchronous Http client engine is used (that is the default).
The sslEnabledProtocols optional attribute specifies the protocol versions to be enabled for use on the connection.
The sslCipherSuites optional attribute specifies cipher suite names used by the SSL connection.
Duration
,
KeyManagerHeaplet
,
TrustManagerHeaplet
Modifier and Type | Class and Description |
---|---|
static class |
ClientHandler.Heaplet
Creates and initializes a client handler in a heap environment.
|
Constructor and Description |
---|
ClientHandler(Handler delegate)
Creates a new client handler.
|
public ClientHandler(Handler delegate)
delegate
- The HTTP Handler delegate.public Promise<Response,NeverThrowsException> handle(Context context, Request request)
Handler
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 2011-2015 ForgeRock AS.