因为工作需要,要使用Java代码模拟登录过程,抓取某系统的订单数据;
上网查询资料,发现使用HttpClient可以模拟登录过程;
本着取各家之长的态度,发现有些博文使用了 org.apache.commons.httpclient.HttpClient 类,
另外有些博文则使用了 org.apache.http.client.HttpClient 类;
为了搞清楚其中的关系,找度娘,却不甩我;
无意中,从官网看到一段话,
image.png
原来,commons-httpclient 是 apache-commons 项目下的一个子项目,后来被 HttpComponents 取代,
后者提供了更好的性能和更大的灵活性。
原文地址如下:http://hc.apache.org/httpclient-3.x/
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.5</version>
</dependency>
截止目前(2018-07-01),最新版本为4.5.5;