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;
*/
public class HttpUtils {
int i=0;
private Logger logger = LoggerFactory.getLogger(HttpUtils.class);
private static Logger logger = LoggerFactory.getLogger(HttpUtils.class);
/**
* post请求 ,超时默认10秒, 默认utf-8
* @param url
......@@ -49,7 +49,7 @@ public class HttpUtils {
*/
@SuppressWarnings("deprecation")
public String post(String url, Map<String, String> params) throws Exception {
return this.post(url, params, 10, HTTP.UTF_8);
return this.post(url, params, 10, HTTP.UTF_8);
}
/**
* post请求, 超时默认10秒
......@@ -106,6 +106,7 @@ public class HttpUtils {
HttpPost httppost = new HttpPost(url);
httppost.setEntity(entity);
HttpResponse resp = httpclient.execute(httppost);
retVal = EntityUtils.toString(resp.getEntity(), charset);
} catch (IOException e) {
logger.error(" post error : ", e);
......@@ -208,6 +209,7 @@ public class HttpUtils {
HttpResponse resp = httpclient.execute(httpget);
retVal = EntityUtils.toString(resp.getEntity(), charset);
} catch (IOException e) {
logger.info("get请求出现异常....." + e.getMessage());
throw e;
} finally {
httpclient.getConnectionManager().shutdown();
......@@ -231,7 +233,7 @@ public class HttpUtils {
httpclient.getParams().setIntParameter("http.socket.timeout", timeout * 1000);
httpclient.getParams().setBooleanParameter("http.protocol.expect-continue", false);
String retVal = "";
fNameEndChar=(fNameEndChar==null || "".endsWith(fNameEndChar))? "?":fNameEndChar;
fNameEndChar=fNameEndChar==null || "".endsWith(fNameEndChar)? "?":fNameEndChar;
try {
List<NameValuePair> qparams = new ArrayList<NameValuePair>();
if (params != null) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!