本文整理汇总了Java中org.apache.http.ConnectionReuseStrategy类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionReuseStrategy类的具体用法?Java ConnectionReuseStrategy怎么用?Java ConnectionReuseStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionReuseStrategy类属于org.apache.http包,在下文中一共展示了ConnectionReuseStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DefaultRequestDirector
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
@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);
}
示例2: MinimalClientExec
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
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;
}
示例3: HttpTestServer
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
/**
* 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;
}
示例4: MinimalClientExec
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
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;
}
示例5: createMainExec
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
/**
* 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);
}
示例6: getRequestDirector
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
/** 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);
}
示例7: getRequestDirector
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
/** 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);
}
示例8: createClientRequestDirector
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
/**
* @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);
}
示例9: createConnectionReuseStrategy
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
@Override
protected ConnectionReuseStrategy createConnectionReuseStrategy() {
String s = System.getProperty("http.keepAlive");
if ("true".equalsIgnoreCase(s)) {
return new DefaultConnectionReuseStrategy();
} else {
return new NoConnectionReuseStrategy();
}
}
示例10: HttpService
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
/**
* 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;
}
示例11: setConnReuseStrategy
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
/**
* @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;
}
示例12: YaaccHttpService
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
public YaaccHttpService(HttpProcessor proc,
ConnectionReuseStrategy connStrategy,
HttpResponseFactory responseFactory, Context context) {
super(proc, connStrategy, responseFactory);
this.context = context;
}
示例13: ListeningHandler
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
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;
}
示例14: ConnectingHandler
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
public ConnectingHandler(
final HttpProcessor httpProcessor,
final ConnectionReuseStrategy connStrategy,
final HttpParams params) {
super();
this.httpProcessor = httpProcessor;
this.connStrategy = connStrategy;
this.params = params;
}
示例15: MainClientExec
import org.apache.http.ConnectionReuseStrategy; //导入依赖的package包/类
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;
}