一、环境准备
将使用eclipse和maven完成本次接口请求实现,以下内容,将默认读者已完成环境准备,包括但不限于JDK、maven、IDEA,并熟练掌握他们的使用方法,如若有不清楚的请自行学习。
二、创建一个maven工程
在eclipse中新建一个maven工程,pom.xml文件中引入httpclient、httpmime、httpcore
Maven仓库地址:https://mvnrepository.com/。查找:org.apache.httpcomponents

我这里配置的包版本如下:
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.13</version>
</dependency>
三、包结构

原创文章,作者:三酷猫,如若转载,请注明出处:https://www.sankumao.com/4200.html