yumeng преди 5 години
родител
ревизия
38010c1876
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java

@@ -340,11 +340,14 @@ public class HttpUtils {
         String strReturn = "";
         try {
             HttpPost httppost = new HttpPost(url);
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httppost.setConfig(requestConfig);
             if (!Check.isNullMap(headers)) {
                 for (String key : headers.keySet()) {
                     httppost.setHeader(key, headers.get(key));
                 }
             }
+
             httppost.setHeader("User-Agent", USER_AGENT);
             if (!Check.isNull(body)) {
                 httppost.setEntity(new StringEntity(body, Charset.forName("UTF-8")));