httpclient防止重复提交
This commit is contained in:
parent
837ab404b1
commit
667d486899
|
@ -30,7 +30,9 @@ public class HttpClientUtil {
|
||||||
byte[] responseBytes = null;
|
byte[] responseBytes = null;
|
||||||
|
|
||||||
HttpPost httpPost = new HttpPost(reqURL);
|
HttpPost httpPost = new HttpPost(reqURL);
|
||||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
//CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||||
|
CloseableHttpClient httpClient = HttpClients.custom().disableAutomaticRetries().build(); // disable retry
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// init post
|
// init post
|
||||||
/*if (params != null && !params.isEmpty()) {
|
/*if (params != null && !params.isEmpty()) {
|
||||||
|
@ -62,7 +64,7 @@ public class HttpClientUtil {
|
||||||
EntityUtils.consume(entity);
|
EntityUtils.consume(entity);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error("", e);
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
httpPost.releaseConnection();
|
httpPost.releaseConnection();
|
||||||
|
|
Loading…
Reference in New Issue