httpcliet、commons-httpclient、defaulthttpclient的区别和联系

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这个包。

后者提供了更好的性能和更大的灵活性。


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();






评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值