Commit 60b977c0 authored by yanzg's avatar yanzg

导出Excel边框

parent 55d4990e
...@@ -427,10 +427,11 @@ public class HttpHelper { ...@@ -427,10 +427,11 @@ public class HttpHelper {
/** /**
* post请求form-data * post请求form-data
* @param url *
* @param parametersBody * @param url 请求地址
* @return * @param parametersBody 参数值
* @throws Exception * @return 返回值
* @throws Exception 异常
*/ */
public static String postRequest(String url, List<NameValuePair> parametersBody) throws Exception { public static String postRequest(String url, List<NameValuePair> parametersBody) throws Exception {
HttpEntity entity = new UrlEncodedFormEntity(parametersBody, Charsets.UTF_8); HttpEntity entity = new UrlEncodedFormEntity(parametersBody, Charsets.UTF_8);
...@@ -443,11 +444,11 @@ public class HttpHelper { ...@@ -443,11 +444,11 @@ public class HttpHelper {
post.addHeader("Accept", "application/json"); post.addHeader("Accept", "application/json");
post.setEntity(entity); post.setEntity(entity);
RequestConfig config = RequestConfig.custom() RequestConfig config = RequestConfig.custom()
.setConnectionRequestTimeout(1000) .setConnectionRequestTimeout(HTTP_CONNECT_TIMEOUT)
//服务端相应超时
.setSocketTimeout(1000)
//建立socket链接超时 //建立socket链接超时
.setConnectTimeout(3000) .setConnectTimeout(HTTP_CONNECT_TIMEOUT)
//服务端相应超时
.setSocketTimeout(HTTP_READ_TIMEOUT)
.build(); .build();
post.setConfig(config); post.setConfig(config);
String var8; String var8;
...@@ -455,12 +456,11 @@ public class HttpHelper { ...@@ -455,12 +456,11 @@ public class HttpHelper {
HttpClient client = HttpClientBuilder.create().build(); HttpClient client = HttpClientBuilder.create().build();
HttpResponse response = client.execute(post); HttpResponse response = client.execute(post);
int code = response.getStatusLine().getStatusCode(); int code = response.getStatusLine().getStatusCode();
String result = EntityUtils.toString(response.getEntity());
if (code >= 400) { if (code >= 400) {
throw new Exception(EntityUtils.toString(response.getEntity())); throw new HttpCodeException(String.valueOf(code), result);
} }
var8 = EntityUtils.toString(response.getEntity()); var8 = result;
} catch (Exception var11) {
throw new Exception("postRequest -- Client protocol exception!", var11);
} finally { } finally {
post.releaseConnection(); post.releaseConnection();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment