丽知:修改:中台转发http

This commit is contained in:
zhengyf 2024-08-19 18:48:43 +08:00
parent a7a30efd9e
commit 46add53677
1 changed files with 15 additions and 0 deletions

View File

@ -56,6 +56,13 @@ public class PushU8CByApiCode {
httpPost.setHeader("apicode", apicode); httpPost.setHeader("apicode", apicode);
//data //data
httpPost.setEntity(new StringEntity(data, "UTF-8")); httpPost.setEntity(new StringEntity(data, "UTF-8"));
// 配置请求的超时设置
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(600000) // 连接超时时间: 600秒
.setConnectionRequestTimeout(600000) // 请求超时时间: 600秒
.setSocketTimeout(600000) // 数据读取超时时间: 600秒
.build();
httpPost.setConfig(requestConfig);
CloseableHttpResponse response = httpclient.execute(httpPost); CloseableHttpResponse response = httpclient.execute(httpPost);
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
@ -96,6 +103,14 @@ public class PushU8CByApiCode {
httpPost.setHeader("apicode", apicode); httpPost.setHeader("apicode", apicode);
//data //data
httpPost.setEntity(new StringEntity(data, "UTF-8")); httpPost.setEntity(new StringEntity(data, "UTF-8"));
// 配置请求的超时设置
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(600000) // 连接超时时间: 600秒
.setConnectionRequestTimeout(600000) // 请求超时时间: 600秒
.setSocketTimeout(600000) // 数据读取超时时间: 600秒
.build();
httpPost.setConfig(requestConfig);
CloseableHttpResponse response = httpclient.execute(httpPost); CloseableHttpResponse response = httpclient.execute(httpPost);
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
String result = EntityUtils.toString(entity); String result = EntityUtils.toString(entity);