Example usage for org.apache.http.impl.client HttpAuthenticator HttpAuthenticator

List of usage examples for org.apache.http.impl.client HttpAuthenticator HttpAuthenticator

Introduction

In this page you can find the example usage for org.apache.http.impl.client HttpAuthenticator HttpAuthenticator.

Prototype

public HttpAuthenticator(final Log log) 

Source Link

Usage

From source file:org.apache.http.impl.client.DefaultRequestDirector.java

/**
 * @since 4.2//from  w w w . ja  v  a2  s .  co  m
 */
public DefaultRequestDirector(final Log log, final HttpRequestExecutor requestExec,
        final ClientConnectionManager conman, final ConnectionReuseStrategy reustrat,
        final ConnectionKeepAliveStrategy kastrat, final HttpRoutePlanner rouplan,
        final HttpProcessor httpProcessor, final HttpRequestRetryHandler retryHandler,
        final RedirectStrategy redirectStrategy, final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy, final UserTokenHandler userTokenHandler,
        final HttpParams params) {

    Args.notNull(log, "Log");
    Args.notNull(requestExec, "Request executor");
    Args.notNull(conman, "Client connection manager");
    Args.notNull(reustrat, "Connection reuse strategy");
    Args.notNull(kastrat, "Connection keep alive strategy");
    Args.notNull(rouplan, "Route planner");
    Args.notNull(httpProcessor, "HTTP protocol processor");
    Args.notNull(retryHandler, "HTTP request retry handler");
    Args.notNull(redirectStrategy, "Redirect strategy");
    Args.notNull(targetAuthStrategy, "Target authentication strategy");
    Args.notNull(proxyAuthStrategy, "Proxy authentication strategy");
    Args.notNull(userTokenHandler, "User token handler");
    Args.notNull(params, "HTTP parameters");
    this.log = log;
    this.authenticator = new HttpAuthenticator(log);
    this.requestExec = requestExec;
    this.connManager = conman;
    this.reuseStrategy = reustrat;
    this.keepAliveStrategy = kastrat;
    this.routePlanner = rouplan;
    this.httpProcessor = httpProcessor;
    this.retryHandler = retryHandler;
    this.redirectStrategy = redirectStrategy;
    this.targetAuthStrategy = targetAuthStrategy;
    this.proxyAuthStrategy = proxyAuthStrategy;
    this.userTokenHandler = userTokenHandler;
    this.params = params;

    if (redirectStrategy instanceof DefaultRedirectStrategyAdaptor) {
        this.redirectHandler = ((DefaultRedirectStrategyAdaptor) redirectStrategy).getHandler();
    } else {
        this.redirectHandler = null;
    }
    if (targetAuthStrategy instanceof AuthenticationStrategyAdaptor) {
        this.targetAuthHandler = ((AuthenticationStrategyAdaptor) targetAuthStrategy).getHandler();
    } else {
        this.targetAuthHandler = null;
    }
    if (proxyAuthStrategy instanceof AuthenticationStrategyAdaptor) {
        this.proxyAuthHandler = ((AuthenticationStrategyAdaptor) proxyAuthStrategy).getHandler();
    } else {
        this.proxyAuthHandler = null;
    }

    this.managedConn = null;

    this.execCount = 0;
    this.redirectCount = 0;
    this.targetAuthState = new AuthState();
    this.proxyAuthState = new AuthState();
    this.maxRedirects = this.params.getIntParameter(ClientPNames.MAX_REDIRECTS, 100);
}

From source file:org.apache.http.impl.nio.client.DefaultAsyncRequestDirector.java

public DefaultAsyncRequestDirector(final Log log, final HttpAsyncRequestProducer requestProducer,
        final HttpAsyncResponseConsumer<T> responseConsumer, final HttpContext localContext,
        final ResultCallback<T> callback, final ClientAsyncConnectionManager connmgr,
        final HttpProcessor httppocessor, final HttpRoutePlanner routePlanner,
        final ConnectionReuseStrategy reuseStrategy, final ConnectionKeepAliveStrategy keepaliveStrategy,
        final RedirectStrategy redirectStrategy, final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy, final UserTokenHandler userTokenHandler,
        final HttpParams clientParams) {
    super();/*from   ww w . j a v  a  2 s . co  m*/
    this.log = log;
    this.requestProducer = requestProducer;
    this.responseConsumer = responseConsumer;
    this.localContext = localContext;
    this.resultCallback = callback;
    this.connmgr = connmgr;
    this.httppocessor = httppocessor;
    this.routePlanner = routePlanner;
    this.reuseStrategy = reuseStrategy;
    this.keepaliveStrategy = keepaliveStrategy;
    this.redirectStrategy = redirectStrategy;
    this.routeDirector = new BasicRouteDirector();
    this.targetAuthStrategy = targetAuthStrategy;
    this.proxyAuthStrategy = proxyAuthStrategy;
    this.userTokenHandler = userTokenHandler;
    this.targetAuthState = new AuthState();
    this.proxyAuthState = new AuthState();
    this.authenticator = new HttpAuthenticator(log);
    this.clientParams = clientParams;
    this.id = COUNTER.getAndIncrement();
}