Commit ddde6b79 by zhengxj

finish 优化代码 on 20200410 by zhengxj

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@26331 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent bced4e6f
...@@ -193,7 +193,7 @@ public class HttpUtils { ...@@ -193,7 +193,7 @@ public class HttpUtils {
httpclient.getParams().setIntParameter("http.socket.timeout", timeout * 1000); httpclient.getParams().setIntParameter("http.socket.timeout", timeout * 1000);
httpclient.getParams().setBooleanParameter("http.protocol.expect-continue", false); httpclient.getParams().setBooleanParameter("http.protocol.expect-continue", false);
String retVal = ""; String retVal = "";
try {
List<NameValuePair> qparams = new ArrayList<NameValuePair>(); List<NameValuePair> qparams = new ArrayList<NameValuePair>();
if (params != null) { if (params != null) {
for (Map.Entry<String, String> param : params.entrySet()) { for (Map.Entry<String, String> param : params.entrySet()) {
...@@ -205,12 +205,10 @@ public class HttpUtils { ...@@ -205,12 +205,10 @@ public class HttpUtils {
url = url + "?" + paramstr; url = url + "?" + paramstr;
} }
HttpGet httpget = new HttpGet(url); HttpGet httpget = new HttpGet(url);
try {
HttpResponse resp = httpclient.execute(httpget); HttpResponse resp = httpclient.execute(httpget);
retVal = EntityUtils.toString(resp.getEntity(), charset); retVal = EntityUtils.toString(resp.getEntity(), charset);
} catch (IOException e) {
logger.info("get请求出现异常....." + e.getMessage());
throw e;
} finally { } finally {
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!