我是靠谱客的博主 年轻白昼,这篇文章主要介绍httpcliet、commons-httpclient、defaulthttpclient的区别和联系 The type DefaultHttpClient is deprecated,现在分享给大家,希望可以做个参考。

org.apache.httpcomponents » httpclient

原来,commons-httpclient 是 apache-commons 项目下的一个子项目,后来被 HttpComponents 取代,

除此以外,在apache的官网上下载httpclient的jar包时,会发现它是在一个叫HttpComponent的项目下,这个HttpComponent是apache的顶级项目。而以前的commons的那三个包都是commons的项目下。在HttpComponent的网页上,看到了这样的文字: HttpComponents Client is a successor of and replacement forCommons HttpClient 3.x. Users of Commons HttpClient are strongly encouraged to upgrade.

也就是说commons下的commons-httpclient不在更新和维护了,用commons-httpclient的用户也建议更新到httpclient这个包。

后者提供了更好的性能和更大的灵活性。
原文地址如下:http://hc.apache.org/httpclient-3.x/


PS:
commons-httpclient的GAV地址为
<dependency>
  <groupId>commons-httpclient</groupId>
  <artifactId>commons-httpclient</artifactId>
  <version>3.1</version>
</dependency>
其最新版本为3.1,且已经不再更新;

HttpComponents的GAV地址为
<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpclient</artifactId>
  <version>4.5.1</version>
</dependency>

截止目前(2016-01-05),最新版本为4.5.1;

DefaultHttpClient实现了HttpClient接口,使用时提示

The type DefaultHttpClient is deprecated

HttpClient client = new DefaultHttpClient();
改为:

HttpClient client = HttpClientBuilder.create().build();






最后

以上就是年轻白昼最近收集整理的关于httpcliet、commons-httpclient、defaulthttpclient的区别和联系 The type DefaultHttpClient is deprecated的全部内容,更多相关httpcliet、commons-httpclient、defaulthttpclient的区别和联系内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(121)

评论列表共有 0 条评论

立即
投稿
返回
顶部