0
我正在開發一個Maven插件,最終將二進制文件發佈到服務器。我正在使用HTTPComponents 4.3。我對Java和Apache庫相當陌生,但除此之外,我如何從CloseableHttpClient.execute()
提取上傳進度?如何從CloseableHttpClient POST獲取上傳進度?
我打算通過字節發送或百分比記錄命令行上的進度。
CloseableHttpClient client = HttpClients.createDefault();
HttpPost post = createHttpPost(); //just sets up the HttpPost object
HttpEntity entity = createHttpEntity(); //adds the multipart
post.setEntity(entity);
HttpResponse response;
try {
getLog().info("Executing request.");
response = client.execute(post);
} catch (ClientProtocolException e) {
//handle
} catch (IOException e) {
//handle
}