太阳火神的美丽人生 (http://blog.csdn.net/opengl_es)
本文遵循“署名-非商业用途-保持一致”创作公用协议
标题也就没啥可翻的了,就是 Apache 提供的免费开源的 Http 组件库。Apache 冷不丁翻译过来,自已有些木讷了,不太认识,反而对 Apache 更有敬畏之心。
但使用 Android 的兄弟会发现,Android 已经内置了。
是的,但 Java 并不天生拥有,那么不妨使用一下。
这里需要说明的是,Asynch HttpClient 对 Java NIO 进行了封装,异步网络请求一直是我钟爱的,不用线程阻塞等待,不用 select 检查事件,当然了,内部实现也可能这样做了,但至少不需要我们开发人员来做这些事情。
Android 的 AsynTask 是否会下岗呢?
估计涛声依旧了。。。
Apache HttpComponents
这个 Apache HttpComponents 项目负责创建和维护一组底层 Java 组件,专注于 HTTP 和相关的协议。
The Apache HttpComponents project is responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols.
该项目在 Apache 软件基金会管控下运作,并成为大量社区开发者和用户的一部分。
This project functions under the Apache Software Foundation (http://www.apache.org), and is part of a larger community of developers and users.
概述
HttpComponents Overview
超文本传输协议也许是当今在互联网上使用得最典型的协议。Web 服务,网络可用的应用以及网络计算的增长都在持续地扩大 HTTP 协议在用户驱动的 web 浏览器上角度,同时也提高了需要 HTTP 支持的应用数量。
The Hyper-Text Transfer Protocol (HTTP) is perhaps the most significant protocol used on the Internet today. Web services, network-enabled appliances and the growth of network computing continue to expand the role of the HTTP protocol beyond user-driven web browsers, while increasing the number of applications that require HTTP support.
Designed for extension while providing robust support for the base HTTP protocol, the HttpComponents may be of interest to anyone building HTTP-aware client and server applications such as web browsers, web spiders, HTTP proxies, web service transport libraries, or systems that leverage or extend the HTTP protocol for distributed communication.
HttpComponents Structure
HttpComponents Core
HttpCore is a set of low level HTTP transport components that can be used to build custom client and server side HTTP services with a minimal footprint. HttpCore supports two I/O models: blocking I/O model based on the classic Java I/O and non-blocking, event driven I/O model based on Java NIO.
The blocking I/O model may be more appropriate for data intensive, low latency scenarios, whereas the non-blocking model may be more appropriate for high latency scenarios where raw data throughput is less important than the ability to handle thousands of simultaneous HTTP connections in a resource efficient manner.
HttpComponents Client
HttpClient is a HTTP/1.1 compliant HTTP agent implementation based on HttpCore. It also provides reusable components for client-side authentication, HTTP state management, and HTTP connection management. HttpComponents Client is a successor of and replacement for Commons HttpClient 3.x. Users of Commons HttpClient are strongly encouraged to upgrade.
- HttpClient Tutorial HTML / PDF
- HttpClient Samples
- HttpClient port for Android
HttpComponents AsyncClient
Asynch HttpClient is a HTTP/1.1 compliant HTTP agent implementation based on HttpCore NIO and HttpClient components. It is a complementary module to Apache HttpClient intended for special cases where ability to handle a great number of concurrent connections is more important than performance in terms of a raw data throughput.
- HttpAsyncClient Samples
Commons HttpClient (legacy)
Commons HttpClient 3.x codeline is at the end of life. All users of Commons HttpClient 3.x are strongly encouraged to upgrade to HttpClient 4.1.