org.apache.http.client.NonRepeatableRequestException:无法使用不可重复的请求实体重试请求

时间:2017-06-30 09:17:06

标签: http post apache-commons-httpclient

我使用下面的代码来执行http发布并上传文件并获得下面提到的错误。

我在这里错过了什么吗?

grep -E '"ServiceUserName"|"ServicePassword"' | sort -r >> user.txt

错误:

MultipartEntityBuilder builder = MultipartEntityBuilder.create();   
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
HttpPost request = new HttpPost(serverEndpointUrl + attachementsResource);
System.out.println(serverEndpointUrl + attachementsResource);
request.addHeader("Authorization", getBasicAuth(Authorization));
builder.addBinaryBody("file", fileContent,ContentType.APPLICATION_OCTET_STREAM, fileName);
HttpEntity multipart = builder.build();
request.setEntity(multipart);
response = client.execute(request);

请建议

0 个答案:

没有答案