本文整理汇总了Java中ch.boye.httpclientandroidlib.client.HttpClient类的典型用法代码示例。如果您正苦于以下问题:Java HttpClient类的具体用法?Java HttpClient怎么用?Java HttpClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpClient类属于ch.boye.httpclientandroidlib.client包,在下文中一共展示了HttpClient类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: wrapClient
import ch.boye.httpclientandroidlib.client.HttpClient; //导入依赖的package包/类
public static AbstractHttpClient wrapClient(HttpClient base) {
try {
SSLContext ctx = SSLContext.getInstance("TLS");
X509TrustManager tm = new X509AlwaysTrust();
ctx.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory ssf = new ch.boye.httpclientandroidlib.conn.ssl.SSLSocketFactory(
ctx);
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
ClientConnectionManager ccm = base.getConnectionManager();
SchemeRegistry sr = ccm.getSchemeRegistry();
sr.register(new Scheme("https", ssf, 443));
return new DefaultHttpClient(ccm, base.getParams());
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
开发者ID:starn,项目名称:encdroidMC,代码行数:19,代码来源:FileProvider7.java
示例2: AutoRetryHttpClient
import ch.boye.httpclientandroidlib.client.HttpClient; //导入依赖的package包/类
public AutoRetryHttpClient(
final HttpClient client, final ServiceUnavailableRetryStrategy retryStrategy) {
super();
Args.notNull(client, "HttpClient");
Args.notNull(retryStrategy, "ServiceUnavailableRetryStrategy");
this.backend = client;
this.retryStrategy = retryStrategy;
}
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:9,代码来源:AutoRetryHttpClient.java
示例3: HttpRequestTaskCallable
import ch.boye.httpclientandroidlib.client.HttpClient; //导入依赖的package包/类
HttpRequestTaskCallable(
final HttpClient httpClient,
final HttpUriRequest request,
final HttpContext context,
final ResponseHandler<V> responseHandler,
final FutureCallback<V> callback,
final FutureRequestExecutionMetrics metrics) {
this.httpclient = httpClient;
this.responseHandler = responseHandler;
this.request = request;
this.context = context;
this.callback = callback;
this.metrics = metrics;
}
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:15,代码来源:HttpRequestTaskCallable.java
示例4: DecompressingHttpClient
import ch.boye.httpclientandroidlib.client.HttpClient; //导入依赖的package包/类
DecompressingHttpClient(final HttpClient backend,
final HttpRequestInterceptor requestInterceptor,
final HttpResponseInterceptor responseInterceptor) {
this.backend = backend;
this.acceptEncodingInterceptor = requestInterceptor;
this.contentEncodingInterceptor = responseInterceptor;
}
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:8,代码来源:DecompressingHttpClient.java
示例5: closeQuietly
import ch.boye.httpclientandroidlib.client.HttpClient; //导入依赖的package包/类
/**
* Unconditionally close a httpClient. Shuts down the underlying connection
* manager and releases the resources.
* <p>
* Example Code:
*
* <pre>
* HttpClient httpClient = HttpClients.createDefault();
* try {
* httpClient.execute(request);
* } catch (Exception e) {
* // error handling
* } finally {
* HttpClientUtils.closeQuietly(httpClient);
* }
* </pre>
*
* @param httpClient
* the HttpClient to close, may be null or already closed.
* @since 4.2
*/
public static void closeQuietly(final HttpClient httpClient) {
if (httpClient != null) {
if (httpClient instanceof Closeable) {
try {
((Closeable) httpClient).close();
} catch (final IOException ignore) {
}
}
}
}
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:32,代码来源:HttpClientUtils.java
示例6: FutureRequestExecutionService
import ch.boye.httpclientandroidlib.client.HttpClient; //导入依赖的package包/类
/**
* Create a new FutureRequestExecutionService.
*
* @param httpclient
* you should tune your httpclient instance to match your needs. You should
* align the max number of connections in the pool and the number of threads
* in the executor; it doesn't make sense to have more threads than connections
* and if you have less connections than threads, the threads will just end up
* blocking on getting a connection from the pool.
* @param executorService
* any executorService will do here. E.g.
* {@link java.util.concurrent.Executors#newFixedThreadPool(int)}
*/
public FutureRequestExecutionService(
final HttpClient httpclient,
final ExecutorService executorService) {
this.httpclient = httpclient;
this.executorService = executorService;
}
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:20,代码来源:FutureRequestExecutionService.java
示例7: getHttpClient
import ch.boye.httpclientandroidlib.client.HttpClient; //导入依赖的package包/类
/**
* Gets the HttpClient to issue request.
*
* @return the HttpClient to issue request
*/
public HttpClient getHttpClient() {
return this.backend;
}
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:9,代码来源:DecompressingHttpClient.java
注:本文中的ch.boye.httpclientandroidlib.client.HttpClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论