From 46add5367787cfde5a874c3c87ec21e2c34fe8f7 Mon Sep 17 00:00:00 2001 From: zhengyf Date: Mon, 19 Aug 2024 18:48:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BD=E7=9F=A5=EF=BC=9A=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=E4=B8=AD=E5=8F=B0=E8=BD=AC=E5=8F=91http?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lets/util/pushData/PushU8CByApiCode.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/PushU8CByApiCode.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/PushU8CByApiCode.java index dd869fc8..37082550 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/PushU8CByApiCode.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/pushData/PushU8CByApiCode.java @@ -56,6 +56,13 @@ public class PushU8CByApiCode { httpPost.setHeader("apicode", apicode); //data 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); HttpEntity entity = response.getEntity(); @@ -96,6 +103,14 @@ public class PushU8CByApiCode { httpPost.setHeader("apicode", apicode); //data 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); HttpEntity entity = response.getEntity(); String result = EntityUtils.toString(entity);