服务器间传送文件
参考文章http://www.baeldung.com/httpclient-multipart-upload
首先,引入发送Http请求的依赖
<dependency><groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.6</version>
</dependency>
1、使用HttpClient发送InputStream对象
public void inputStreamUpload() {
//创建HttpClient对象
CloseableHttpClient client = HttpClients.createDefault();
//构建POST请求 请求地址请更换为自己的。
//1)
HttpPost post = new HttpPost("http://localhost:8003/upl