public final class AsyncUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
calculateSignature(Signer signer,
com.ning.http.client.Request request,
com.ning.http.client.RequestBuilderBase<?> requestBuilder,
String requestLineFormat) |
static void |
enableAuth(com.ning.http.client.AsyncHttpClient client,
Signer signer)
Attaches the provided
Signer to the AsyncHttpClient as a signature calculator. |
static String |
escapeQueryString(String query)
really? really? So much request munging happens after the
AsyncSignatureCalculator is called... |
static String |
getRequestLine(com.ning.http.client.Request request,
String requestLineFormat) |
static Future<com.ning.http.client.Response> |
login(com.ning.http.client.AsyncHttpClient client,
Signer signer,
com.ning.http.client.Request loginRequest)
Executes and replays a login request until one is found which satisfies the
Challenge being returned by the server, or until there are no more keys in the
keychain. |
static <T> Future<T> |
login(com.ning.http.client.AsyncHttpClient client,
Signer signer,
com.ning.http.client.Request loginRequest,
com.ning.http.client.AsyncCompletionHandler<T> responseHandler)
Executes and replays a login request until one is found which satisfies the
Challenge being returned by the server, or until there are no more keys in the
keychain. |
public static void enableAuth(com.ning.http.client.AsyncHttpClient client,
Signer signer)
Signer to the AsyncHttpClient as a signature calculator.
It is expected that key rotation and Challenge management is outside the scope
of this method, so only the Keychain.currentKey() will be used, and signature
content will be built according to the last Challenge provided to the
Signer.rotateKeys(net.adamcin.httpsig.api.Challenge) method.client - the AsyncHttpClient to use forsigner - the Signer to use for authentication. It's keys must be rotated separately.login(com.ning.http.client.AsyncHttpClient, net.adamcin.httpsig.api.Signer, com.ning.http.client.Request)public static Future<com.ning.http.client.Response> login(com.ning.http.client.AsyncHttpClient client, Signer signer, com.ning.http.client.Request loginRequest) throws IOException
Challenge being returned by the server, or until there are no more keys in the
keychain.client - the AsyncHttpClient to which the Signer will be attachedsigner - the Signer used for login and subsequent signature authenticationloginRequest - the login Request to be executed and replayed while rotating the keychainFuture expecting a ResponseIOException - if a request throws an exceptionpublic static <T> Future<T> login(com.ning.http.client.AsyncHttpClient client, Signer signer, com.ning.http.client.Request loginRequest, com.ning.http.client.AsyncCompletionHandler<T> responseHandler) throws IOException
Challenge being returned by the server, or until there are no more keys in the
keychain.T - type parameter for completion handlerclient - the AsyncHttpClient to which the Signer will be attachedsigner - the Signer used for login and subsequent signature authenticationloginRequest - the login Request to be executed and replayed while rotating the keychainresponseHandler - an AsyncCompletionHandler of type TFuture of type TIOException - if thrown by a login requestpublic static String escapeQueryString(String query)
AsyncSignatureCalculator is called...query - public static String getRequestLine(com.ning.http.client.Request request, String requestLineFormat)
Copyright © 2013. All Rights Reserved.