-
大小: 2.9MB文件类型: .zip金币: 1下载: 0 次发布日期: 2023-08-16
- 语言: 其他
- 标签: httpclient
资源简介
httpClient 是 Apache Jakarta Common 下的子项目,可以用来提供高效的、最新的、功能丰富的支持 HTTP 协议的客户端编程工具包,并且它支持 HTTP 协议最新的版本和建议。目前是最新的4.5版。
代码片段和文件信息
/*
* ====================================================================
* 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-05-31 13:24 httpcomponents-client-4.5\
文件 27755 2015-05-31 12:51 httpcomponents-client-4.5\LICENSE.txt
文件 2700 2015-05-31 12:51 httpcomponents-client-4.5\README.txt
文件 189 2015-05-31 12:51 httpcomponents-client-4.5\NOTICE.txt
文件 87940 2015-05-31 12:51 httpcomponents-client-4.5\RELEASE_NOTES.txt
目录 0 2015-05-31 13:24 httpcomponents-client-4.5\tutorial\
目录 0 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\
文件 16620 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\advanced.html
文件 13215 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\caching.html
文件 31829 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\authentication.html
文件 7193 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\fluent.html
文件 13380 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\index.html
文件 17195 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\statemgmt.html
文件 34640 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\connmgmt.html
文件 52034 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\fundamentals.html
文件 4857 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\preface.html
目录 0 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\images\
文件 2451 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\images\hc_logo.png
文件 5866 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\images\asf_logo_wide.gif
目录 0 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\css\
文件 5273 2015-05-31 12:51 httpcomponents-client-4.5\tutorial\html\css\hc-tutorial.css
目录 0 2015-05-31 12:52 httpcomponents-client-4.5\tutorial\pdf\
文件 238980 2015-05-31 12:52 httpcomponents-client-4.5\tutorial\pdf\httpclient-tutorial.pdf
目录 0 2015-05-31 13:24 httpcomponents-client-4.5\examples\
目录 0 2015-05-31 12:53 httpcomponents-client-4.5\examples\org\
目录 0 2015-05-31 12:53 httpcomponents-client-4.5\examples\org\apache\
目录 0 2015-05-31 12:53 httpcomponents-client-4.5\examples\org\apache\http\
目录 0 2015-05-31 12:53 httpcomponents-client-4.5\examples\org\apache\http\examples\
目录 0 2015-05-31 12:53 httpcomponents-client-4.5\examples\org\apache\http\examples\client\
文件 4329 2015-05-31 12:53 httpcomponents-client-4.5\examples\org\apache\http\examples\client\ClientPreemptiveDigestAuthentication.java
文件 4963 2015-05-31 12:53 httpcomponents-client-4.5\examples\org\apache\http\examples\client\ClientExecuteSOCKS.java
............此处省略41个文件信息
- 上一篇:GIS地理信息系统图标大全
- 下一篇:网络安全实验平台实验报告
相关资源
- org.apache.commons.httpclient资源包4.2
- 通过httpclient获取到JSON数据,展示到
- OkHttpClientManager
-
httpclient 客户端发送xm
l报文到服务器 - httpclient4.3 封装工具类
- Apache HttpClient 4.5.6
- WebApi系列-通过HttpClient来调用WebApi接口
- 统一管理系统
- 监控网页内容,发现需要的内容后弹
- httpclient请求httpsdemo
- HttpClient工具类
- HttpClient工具详细
- httpClient 调用远程接口 获取数据到本
- HttpClient4.3教程.PDF
- HttpClient发送post请求传输json数据
- org.apache.commons.httpclient
- org.apache.commons.httpclient相关架包
- httpclient以及依赖的jar包
- HttpClient.jar codec.jar logging.jar
- httpclient教程
评论
共有 条评论