-
大小: 2.89MB文件类型: .zip金币: 2下载: 0 次发布日期: 2023-09-12
- 语言: Java
- 标签: httpclient 4.4 jar包
资源简介
官网上最新的httpclient 4.4 jar包 包含了CloseableHttpClient

代码片段和文件信息
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License Version 2.0 (the
* “License“); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing
* software distributed under the License is distributed on an
* “AS IS“ BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation please see
* .
*
*/
package org.apache.http.client.fluent;
import java.util.linkedList;
import java.util.Queue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.apache.http.concurrent.FutureCallback;
/**
* This example demonstrates how the he HttpClient fluent API can be used to execute multiple
* requests asynchronously using background threads.
*/
public class FluentAsync {
public static void main(String[] args)throws Exception {
// Use pool of two threads
ExecutorService threadpool = Executors.newFixedThreadPool(2);
Async async = Async.newInstance().use(threadpool);
Request[] requests = new Request[] {
Request.Get(“http://www.google.com/“)
Request.Get(“http://www.yahoo.com/“)
Request.Get(“http://www.apache.com/“)
Request.Get(“http://www.apple.com/“)
};
Queue> queue = new linkedList>();
// Execute requests asynchronously
for (final Request request: requests) {
Future future = async.execute(request new FutureCallback() {
@Override
public void failed(final Exception ex) {
System.out.println(ex.getMessage() + “: “ + request);
}
@Override
public void completed(final Content content) {
System.out.println(“Request completed: “ + request);
}
@Override
public void cancelled() {
}
});
queue.add(fut
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-01-27 22:01 httpcomponents-client-4.4\
文件 85734 2015-01-27 21:47 httpcomponents-client-4.4\RELEASE_NOTES.txt
文件 27755 2015-01-27 21:47 httpcomponents-client-4.4\LICENSE.txt
文件 2704 2015-01-27 21:47 httpcomponents-client-4.4\README.txt
文件 189 2015-01-27 21:47 httpcomponents-client-4.4\NOTICE.txt
目录 0 2015-01-27 22:01 httpcomponents-client-4.4\tutorial\
目录 0 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\
文件 13215 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\caching.html
文件 7193 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\fluent.html
文件 17195 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\statemgmt.html
文件 16620 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\advanced.html
文件 4857 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\preface.html
文件 31829 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\authentication.html
文件 52034 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\fundamentals.html
文件 34621 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\connmgmt.html
文件 13380 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\index.html
目录 0 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\css\
文件 5273 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\css\hc-tutorial.css
目录 0 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\images\
文件 5866 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\images\asf_logo_wide.gif
文件 2451 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\html\images\hc_logo.png
目录 0 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\pdf\
文件 238950 2015-01-27 21:47 httpcomponents-client-4.4\tutorial\pdf\httpclient-tutorial.pdf
目录 0 2015-01-27 22:01 httpcomponents-client-4.4\examples\
目录 0 2015-01-27 21:48 httpcomponents-client-4.4\examples\org\
目录 0 2015-01-27 21:48 httpcomponents-client-4.4\examples\org\apache\
目录 0 2015-01-27 21:48 httpcomponents-client-4.4\examples\org\apache\http\
目录 0 2015-01-27 21:48 httpcomponents-client-4.4\examples\org\apache\http\examples\
目录 0 2015-01-27 21:48 httpcomponents-client-4.4\examples\org\apache\http\examples\client\
文件 3967 2015-01-27 21:48 httpcomponents-client-4.4\examples\org\apache\http\examples\client\QuickStart.java
文件 3339 2015-01-27 21:48 httpcomponents-client-4.4\examples\org\apache\http\examples\client\ClientCustomSSL.java
............此处省略41个文件信息
- 上一篇:javaFX基础教程及详实
- 下一篇:TSP 蚁群完整JAVA程序
相关资源
- JNA所需要的jar包
- jsonarray所必需的6个jar包.rar
- utgard用到的jar包
- Android v7的一些jar包
- windows 系统下启动与结束java的jar包的
- axis.jar及依赖jar包
- commons-codec-1.3.jar和commons-httpclient-3.0
- Java HttpClient 4.x Jar包
-
ba
se64Encode编码,jar包源代码打包 - sqlserver2008连接所需jar包六个
- jdk和cglib动态代理的{jar包+源码}
- cglibjar包
- 传智itcast-bookstore所需jar包
- kettle连接数据库相关jar包
- mysql-connector-java-5.1.17.jar
- Android直连Mysql数据库需要导入的jar包
- oracle11g jar包for JDBC
- oracle 11g jdbc jar包
- mysql-5.1.40-bin jar包
- DBCP 数据源jar包
- c3p0-0.9.5.2的三个jar包 数据库连接池
- jersey1.18 jar包
- 使用JSTL需要的jar包程序文件
- mybatis-3.4.4
- Spring4.2.9+mybatis3.4.4集成整合Jackson版支
- JavaMail的JAR包
- 连接数据库mysql所需jar包
- DbVisualizer 10.0.14 破解jar包
- smali jar包
- android-support-design.jar(24.0.0版本)
评论
共有 条评论