Commit 56d3f1c3 by zhengxj

finish 打印必要日志 on 20200410 by zhengxj

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@26327 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent f9cc7132
...@@ -39,7 +39,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -39,7 +39,7 @@ import com.alibaba.fastjson.JSONObject;
*/ */
public class HttpUtils { public class HttpUtils {
int i=0; int i=0;
private Logger logger = LoggerFactory.getLogger(HttpUtils.class); private static Logger logger = LoggerFactory.getLogger(HttpUtils.class);
/** /**
* post请求 ,超时默认10秒, 默认utf-8 * post请求 ,超时默认10秒, 默认utf-8
* @param url * @param url
...@@ -106,6 +106,7 @@ public class HttpUtils { ...@@ -106,6 +106,7 @@ public class HttpUtils {
HttpPost httppost = new HttpPost(url); HttpPost httppost = new HttpPost(url);
httppost.setEntity(entity); httppost.setEntity(entity);
HttpResponse resp = httpclient.execute(httppost); HttpResponse resp = httpclient.execute(httppost);
retVal = EntityUtils.toString(resp.getEntity(), charset); retVal = EntityUtils.toString(resp.getEntity(), charset);
} catch (IOException e) { } catch (IOException e) {
logger.error(" post error : ", e); logger.error(" post error : ", e);
...@@ -208,6 +209,7 @@ public class HttpUtils { ...@@ -208,6 +209,7 @@ public class HttpUtils {
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) { } catch (IOException e) {
logger.info("get请求出现异常....." + e.getMessage());
throw e; throw e;
} finally { } finally {
httpclient.getConnectionManager().shutdown(); httpclient.getConnectionManager().shutdown();
...@@ -231,7 +233,7 @@ public class HttpUtils { ...@@ -231,7 +233,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 = "";
fNameEndChar=(fNameEndChar==null || "".endsWith(fNameEndChar))? "?":fNameEndChar; fNameEndChar=fNameEndChar==null || "".endsWith(fNameEndChar)? "?":fNameEndChar;
try { try {
List<NameValuePair> qparams = new ArrayList<NameValuePair>(); List<NameValuePair> qparams = new ArrayList<NameValuePair>();
if (params != null) { if (params != null) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!