@Deprecated public DefaultRequestDirector( final HttpRequestExecutor requestExec, final ClientConnectionManager conman, final ConnectionReuseStrategy reustrat, final ConnectionKeepAliveStrategy kastrat, final HttpRoutePlanner rouplan, final HttpProcessor httpProcessor, final HttpRequestRetryHandler retryHandler, final RedirectHandler redirectHandler, final AuthenticationHandler targetAuthHandler, final AuthenticationHandler proxyAuthHandler, final UserTokenHandler userTokenHandler, final HttpParams params) { this(LogFactory.getLog(DefaultRequestDirector.class), requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, new DefaultRedirectStrategyAdaptor(redirectHandler), new AuthenticationStrategyAdaptor(targetAuthHandler), new AuthenticationStrategyAdaptor(proxyAuthHandler), userTokenHandler, params); }
@Deprecated 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 AuthenticationHandler targetAuthHandler, final AuthenticationHandler proxyAuthHandler, final UserTokenHandler userTokenHandler, final HttpParams params) { this(LogFactory.getLog(DefaultRequestDirector.class), requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, redirectStrategy, new AuthenticationStrategyAdaptor(targetAuthHandler), new AuthenticationStrategyAdaptor(proxyAuthHandler), userTokenHandler, params); }
public MinimalClientExec( final HttpRequestExecutor requestExecutor, final HttpClientConnectionManager connManager, final ConnectionReuseStrategy reuseStrategy, final ConnectionKeepAliveStrategy keepAliveStrategy) { Args.notNull(requestExecutor, "HTTP request executor"); Args.notNull(connManager, "Client connection manager"); Args.notNull(reuseStrategy, "Connection reuse strategy"); Args.notNull(keepAliveStrategy, "Connection keep alive strategy"); this.httpProcessor = new ImmutableHttpProcessor( new RequestContentHC4(), new RequestTargetHostHC4(), new RequestClientConnControl(), new RequestUserAgentHC4(VersionInfoHC4.getUserAgent( "Apache-HttpClient", "org.apache.http.client", getClass()))); this.requestExecutor = requestExecutor; this.connManager = connManager; this.reuseStrategy = reuseStrategy; this.keepAliveStrategy = keepAliveStrategy; }
/** * Creates a new test server. * * @param proc the HTTP processors to be used by the server, or * <code>null</code> to use a * {@link #newProcessor default} processor * @param reuseStrat the connection reuse strategy to be used by the * server, or <code>null</code> to use * {@link #newConnectionReuseStrategy() default} * strategy. * @param params the parameters to be used by the server, or * <code>null</code> to use * {@link #newDefaultParams default} parameters * @param sslcontext optional SSL context if the server is to leverage * SSL/TLS transport security */ public HttpTestServer( final BasicHttpProcessor proc, final ConnectionReuseStrategy reuseStrat, final HttpResponseFactory responseFactory, final HttpExpectationVerifier expectationVerifier, final HttpParams params, final SSLContext sslcontext) { this.handlerRegistry = new HttpRequestHandlerRegistry(); this.workers = Collections.synchronizedSet(new HashSet<Worker>()); this.httpservice = new HttpService( proc != null ? proc : newProcessor(), reuseStrat != null ? reuseStrat : newConnectionReuseStrategy(), responseFactory != null ? responseFactory : newHttpResponseFactory(), handlerRegistry, expectationVerifier, params != null ? params : newDefaultParams()); this.sslcontext = sslcontext; }
public MinimalClientExec( final HttpRequestExecutor requestExecutor, final HttpClientConnectionManager connManager, final ConnectionReuseStrategy reuseStrategy, final ConnectionKeepAliveStrategy keepAliveStrategy) { Args.notNull(requestExecutor, "HTTP request executor"); Args.notNull(connManager, "Client connection manager"); Args.notNull(reuseStrategy, "Connection reuse strategy"); Args.notNull(keepAliveStrategy, "Connection keep alive strategy"); this.httpProcessor = new ImmutableHttpProcessor( new RequestContent(), new RequestTargetHost(), new RequestClientConnControl(), new RequestUserAgent(VersionInfo.getUserAgent( "Apache-HttpClient", "org.apache.http.client", getClass()))); this.requestExecutor = requestExecutor; this.connManager = connManager; this.reuseStrategy = reuseStrategy; this.keepAliveStrategy = keepAliveStrategy; }
/** * Produces an instance of {@link ClientExecChain} to be used as a main exec. * <p> * Default implementation produces an instance of {@link MainClientExec} * </p> * <p> * For internal use. * </p> * * @since 4.4 */ protected ClientExecChain createMainExec( final HttpRequestExecutor requestExec, final HttpClientConnectionManager connManager, final ConnectionReuseStrategy reuseStrategy, final ConnectionKeepAliveStrategy keepAliveStrategy, final HttpProcessor proxyHttpProcessor, final AuthenticationStrategy targetAuthStrategy, final AuthenticationStrategy proxyAuthStrategy, final UserTokenHandler userTokenHandler) { return new MainClientExec( requestExec, connManager, reuseStrategy, keepAliveStrategy, proxyHttpProcessor, targetAuthStrategy, proxyAuthStrategy, userTokenHandler); }
/** This method mainly exists to make the wrapper more testable. oh, apache's insanity. */ protected RequestDirector getRequestDirector(HttpRequestExecutor requestExec, ClientConnectionManager conman, ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectHandler redirectHandler, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler stateHandler, HttpParams params ) { return new DefaultRequestDirector(requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler, stateHandler, params); }
/** * @deprecated (4.1) do not use */ @Deprecated protected RequestDirector createClientRequestDirector( final HttpRequestExecutor requestExec, final ClientConnectionManager conman, final ConnectionReuseStrategy reustrat, final ConnectionKeepAliveStrategy kastrat, final HttpRoutePlanner rouplan, final HttpProcessor httpProcessor, final HttpRequestRetryHandler retryHandler, final RedirectHandler redirectHandler, final AuthenticationHandler targetAuthHandler, final AuthenticationHandler proxyAuthHandler, final UserTokenHandler userTokenHandler, final HttpParams params) { return new DefaultRequestDirector( requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler, userTokenHandler, params); }
/** * @deprecated (4.2) do not use */ @Deprecated protected RequestDirector createClientRequestDirector( 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 AuthenticationHandler targetAuthHandler, final AuthenticationHandler proxyAuthHandler, final UserTokenHandler userTokenHandler, final HttpParams params) { return new DefaultRequestDirector( log, requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, redirectStrategy, targetAuthHandler, proxyAuthHandler, userTokenHandler, params); }
/** * @since 4.2 */ protected RequestDirector createClientRequestDirector( 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) { return new DefaultRequestDirector( log, requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, redirectStrategy, targetAuthStrategy, proxyAuthStrategy, userTokenHandler, params); }
@Override protected ConnectionReuseStrategy createConnectionReuseStrategy() { String s = System.getProperty("http.keepAlive"); if ("true".equalsIgnoreCase(s)) { return new DefaultConnectionReuseStrategy(); } else { return new NoConnectionReuseStrategy(); } }
/** * Create a new HTTP service. * * @param processor the processor to use on requests and responses * @param connStrategy the connection reuse strategy * @param responseFactory the response factory * @param handlerResolver the handler resolver. May be null. * @param expectationVerifier the expectation verifier. May be null. * @param params the HTTP parameters * * @since 4.1 */ public HttpService( final HttpProcessor processor, final ConnectionReuseStrategy connStrategy, final HttpResponseFactory responseFactory, final HttpRequestHandlerResolver handlerResolver, final HttpExpectationVerifier expectationVerifier, final HttpParams params) { super(); if (processor == null) { throw new IllegalArgumentException("HTTP processor may not be null"); } if (connStrategy == null) { throw new IllegalArgumentException("Connection reuse strategy may not be null"); } if (responseFactory == null) { throw new IllegalArgumentException("Response factory may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } this.processor = processor; this.connStrategy = connStrategy; this.responseFactory = responseFactory; this.handlerResolver = handlerResolver; this.expectationVerifier = expectationVerifier; this.params = params; }
/** * Create a new HTTP service. * * @param proc the processor to use on requests and responses * @param connStrategy the connection reuse strategy * @param responseFactory the response factory * * @deprecated (4.1) use {@link HttpService#HttpService(HttpProcessor, * ConnectionReuseStrategy, HttpResponseFactory, HttpRequestHandlerResolver, HttpParams)} */ @Deprecated public HttpService( final HttpProcessor proc, final ConnectionReuseStrategy connStrategy, final HttpResponseFactory responseFactory) { super(); setHttpProcessor(proc); setConnReuseStrategy(connStrategy); setResponseFactory(responseFactory); }
/** * @deprecated (4.1) set {@link ConnectionReuseStrategy} using constructor */ @Deprecated public void setConnReuseStrategy(final ConnectionReuseStrategy connStrategy) { if (connStrategy == null) { throw new IllegalArgumentException("Connection reuse strategy may not be null"); } this.connStrategy = connStrategy; }
public YaaccHttpService(HttpProcessor proc, ConnectionReuseStrategy connStrategy, HttpResponseFactory responseFactory, Context context) { super(proc, connStrategy, responseFactory); this.context = context; }
public ListeningHandler( final HttpHost targetHost, final ConnectingIOReactor connectingIOReactor, final HttpProcessor httpProcessor, final HttpResponseFactory responseFactory, final ConnectionReuseStrategy connStrategy, final HttpParams params) { super(); this.targetHost = targetHost; this.connectingIOReactor = connectingIOReactor; this.httpProcessor = httpProcessor; this.connStrategy = connStrategy; this.responseFactory = responseFactory; this.params = params; }
public ConnectingHandler( final HttpProcessor httpProcessor, final ConnectionReuseStrategy connStrategy, final HttpParams params) { super(); this.httpProcessor = httpProcessor; this.connStrategy = connStrategy; this.params = params; }
public MainClientExec( final HttpRequestExecutor requestExecutor, final HttpClientConnectionManager connManager, final ConnectionReuseStrategy reuseStrategy, final ConnectionKeepAliveStrategy keepAliveStrategy, final AuthenticationStrategy targetAuthStrategy, final AuthenticationStrategy proxyAuthStrategy, final UserTokenHandler userTokenHandler) { Args.notNull(requestExecutor, "HTTP request executor"); Args.notNull(connManager, "Client connection manager"); Args.notNull(reuseStrategy, "Connection reuse strategy"); Args.notNull(keepAliveStrategy, "Connection keep alive strategy"); Args.notNull(targetAuthStrategy, "Target authentication strategy"); Args.notNull(proxyAuthStrategy, "Proxy authentication strategy"); Args.notNull(userTokenHandler, "User token handler"); this.authenticator = new HttpAuthenticator(); this.proxyHttpProcessor = new ImmutableHttpProcessor( new RequestTargetHostHC4(), new RequestClientConnControl()); this.routeDirector = new BasicRouteDirector(); this.requestExecutor = requestExecutor; this.connManager = connManager; this.reuseStrategy = reuseStrategy; this.keepAliveStrategy = keepAliveStrategy; this.targetAuthStrategy = targetAuthStrategy; this.proxyAuthStrategy = proxyAuthStrategy; this.userTokenHandler = userTokenHandler; }
public HttpCoreTransportClientImpl(HttpRequestExecutor httpexecutor, HttpProcessor httpproc, ConnectionReuseStrategy connStrategy, final HttpClientConnection conn, final HttpRequest request, final HttpResponse response, final HttpContext context) { this.httpexecutor = httpexecutor; this.httpproc = httpproc; this.connStrategy = connStrategy; this.conn = conn; this.request = request; this.response = response; this.context = context; }
@Override protected ConnectionReuseStrategy createConnectionReuseStrategy() { final String s = System.getProperty("http.keepAlive", "true"); if ("true".equalsIgnoreCase(s)) { return new DefaultConnectionReuseStrategy(); } else { return new NoConnectionReuseStrategy(); } }
/** * @since 4.4 */ public MainClientExec( final HttpRequestExecutor requestExecutor, final HttpClientConnectionManager connManager, final ConnectionReuseStrategy reuseStrategy, final ConnectionKeepAliveStrategy keepAliveStrategy, final HttpProcessor proxyHttpProcessor, final AuthenticationStrategy targetAuthStrategy, final AuthenticationStrategy proxyAuthStrategy, final UserTokenHandler userTokenHandler) { Args.notNull(requestExecutor, "HTTP request executor"); Args.notNull(connManager, "Client connection manager"); Args.notNull(reuseStrategy, "Connection reuse strategy"); Args.notNull(keepAliveStrategy, "Connection keep alive strategy"); Args.notNull(proxyHttpProcessor, "Proxy HTTP processor"); Args.notNull(targetAuthStrategy, "Target authentication strategy"); Args.notNull(proxyAuthStrategy, "Proxy authentication strategy"); Args.notNull(userTokenHandler, "User token handler"); this.authenticator = new HttpAuthenticator(); this.routeDirector = new BasicRouteDirector(); this.requestExecutor = requestExecutor; this.connManager = connManager; this.reuseStrategy = reuseStrategy; this.keepAliveStrategy = keepAliveStrategy; this.proxyHttpProcessor = proxyHttpProcessor; this.targetAuthStrategy = targetAuthStrategy; this.proxyAuthStrategy = proxyAuthStrategy; this.userTokenHandler = userTokenHandler; }
public MainClientExec( final HttpRequestExecutor requestExecutor, final HttpClientConnectionManager connManager, final ConnectionReuseStrategy reuseStrategy, final ConnectionKeepAliveStrategy keepAliveStrategy, final AuthenticationStrategy targetAuthStrategy, final AuthenticationStrategy proxyAuthStrategy, final UserTokenHandler userTokenHandler) { this(requestExecutor, connManager, reuseStrategy, keepAliveStrategy, new ImmutableHttpProcessor(new RequestTargetHost()), targetAuthStrategy, proxyAuthStrategy, userTokenHandler); }
private AndroidHttpClient(ClientConnectionManager paramClientConnectionManager, HttpParams paramHttpParams) { this.delegate = new DefaultHttpClient(paramClientConnectionManager, paramHttpParams) { protected final RequestDirector createClientRequestDirector(HttpRequestExecutor paramAnonymousHttpRequestExecutor, ClientConnectionManager paramAnonymousClientConnectionManager, ConnectionReuseStrategy paramAnonymousConnectionReuseStrategy, ConnectionKeepAliveStrategy paramAnonymousConnectionKeepAliveStrategy, HttpRoutePlanner paramAnonymousHttpRoutePlanner, HttpProcessor paramAnonymousHttpProcessor, HttpRequestRetryHandler paramAnonymousHttpRequestRetryHandler, RedirectHandler paramAnonymousRedirectHandler, AuthenticationHandler paramAnonymousAuthenticationHandler1, AuthenticationHandler paramAnonymousAuthenticationHandler2, UserTokenHandler paramAnonymousUserTokenHandler, HttpParams paramAnonymousHttpParams) { return new ElegantRequestDirector(paramAnonymousHttpRequestExecutor, paramAnonymousClientConnectionManager, paramAnonymousConnectionReuseStrategy, paramAnonymousConnectionKeepAliveStrategy, paramAnonymousHttpRoutePlanner, paramAnonymousHttpProcessor, paramAnonymousHttpRequestRetryHandler, paramAnonymousRedirectHandler, paramAnonymousAuthenticationHandler1, paramAnonymousAuthenticationHandler2, paramAnonymousUserTokenHandler, paramAnonymousHttpParams); } protected final HttpContext createHttpContext() { BasicHttpContext localBasicHttpContext = new BasicHttpContext(); localBasicHttpContext.setAttribute("http.authscheme-registry", getAuthSchemes()); localBasicHttpContext.setAttribute("http.cookiespec-registry", getCookieSpecs()); localBasicHttpContext.setAttribute("http.auth.credentials-provider", getCredentialsProvider()); return localBasicHttpContext; } protected final BasicHttpProcessor createHttpProcessor() { BasicHttpProcessor localBasicHttpProcessor = super.createHttpProcessor(); localBasicHttpProcessor.addRequestInterceptor(AndroidHttpClient.sThreadCheckInterceptor); localBasicHttpProcessor.addRequestInterceptor(new AndroidHttpClient.CurlLogger(AndroidHttpClient.this, (byte)0)); return localBasicHttpProcessor; } }; }
/** * Get a default HttpClient based on the HttpConfiguration object. If required the defaults can * be altered to meet the requirements of the SDK user. The default client does not use connection * pooling and does not reuse connections. Timeouts for connection and socket are taken from the * {@link HttpConfiguration} object. * * @param httpConfiguration * @return CloseableHttpClient */ public static CloseableHttpClient getDefaultClient(HttpConfiguration httpConfiguration) { RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(httpConfiguration.getTimeout()) .setSocketTimeout(httpConfiguration.getTimeout()).build(); HttpClientConnectionManager connectionManager = new BasicHttpClientConnectionManager(); ConnectionReuseStrategy connectionResuseStrategy = new NoConnectionReuseStrategy(); logger.debug("Creating HttpClient with simple no pooling/no connection reuse default settings."); CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).setConnectionManager(connectionManager) .setConnectionReuseStrategy(connectionResuseStrategy).build(); return httpClient; }
private HttpClient getHttpClient() { DefaultHttpClient client = new DefaultHttpClient(); client.setReuseStrategy(new ConnectionReuseStrategy() { @Override public boolean keepAlive(HttpResponse httpResponse, HttpContext httpContext) { return false; } }); return client; }
public void __constructor__( HttpRequestExecutor requestExec, ClientConnectionManager conman, ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectHandler redirectHandler, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler userTokenHandler, HttpParams params) { __constructor__( LogFactory.getLog(DefaultRequestDirector.class), requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler, userTokenHandler, params); }
public DefaultRequestDirector( final HttpRequestExecutor requestExec, final ClientConnectionManager conman, final ConnectionReuseStrategy reustrat, final ConnectionKeepAliveStrategy kastrat, final HttpRoutePlanner rouplan, final HttpProcessor httpProcessor, final HttpRequestRetryHandler retryHandler, final RedirectHandler redirectHandler, final AuthenticationHandler targetAuthHandler, final AuthenticationHandler proxyAuthHandler, final UserTokenHandler userTokenHandler, final HttpParams params) { this(LogFactory.getLog(DefaultRequestDirector.class), requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler, userTokenHandler, params); }
protected RequestDirector createClientRequestDirector( final HttpRequestExecutor requestExec, final ClientConnectionManager conman, final ConnectionReuseStrategy reustrat, final ConnectionKeepAliveStrategy kastrat, final HttpRoutePlanner rouplan, final HttpProcessor httpProcessor, final HttpRequestRetryHandler retryHandler, final RedirectHandler redirectHandler, final AuthenticationHandler targetAuthHandler, final AuthenticationHandler proxyAuthHandler, final UserTokenHandler stateHandler, final HttpParams params) { return new DefaultRequestDirector( log, requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler, stateHandler, params); }
public AxisHttpService( final HttpProcessor httpProcessor, final ConnectionReuseStrategy connStrategy, final HttpResponseFactory responseFactory, final ConfigurationContext configurationContext, final Worker worker) { super(); if (httpProcessor == null) { throw new IllegalArgumentException("HTTP processor may not be null"); } if (connStrategy == null) { throw new IllegalArgumentException("Connection strategy may not be null"); } if (responseFactory == null) { throw new IllegalArgumentException("Response factory may not be null"); } if (worker == null) { throw new IllegalArgumentException("Worker may not be null"); } if (configurationContext == null) { throw new IllegalArgumentException("Configuration context may not be null"); } this.httpProcessor = httpProcessor; this.connStrategy = connStrategy; this.responseFactory = responseFactory; this.configurationContext = configurationContext; this.worker = worker; }