diff --git a/src/main/java/com/nis/util/httpclient/HttpClientUtil.java b/src/main/java/com/nis/util/httpclient/HttpClientUtil.java index 02574f84b..81db51197 100644 --- a/src/main/java/com/nis/util/httpclient/HttpClientUtil.java +++ b/src/main/java/com/nis/util/httpclient/HttpClientUtil.java @@ -16,7 +16,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.client.WebTarget; @@ -25,21 +24,16 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; -import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPatch; -import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URIBuilder; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; @@ -64,52 +58,43 @@ public class HttpClientUtil { * @throws IOException * @throws ClientProtocolException */ - public static String get(String url) throws Exception{ - - CloseableHttpClient httpclient =null; - //请求结果 - CloseableHttpResponse response = null; - String content =""; - logger.info("流量统计数据请求路径:"+url); + public static String get(String destUrl) throws Exception{ //执行get方法 + String result = null; + Response response=null; + String url = ""; try { - //实例化get方法 - HttpGet httpget = new HttpGet(url); - //实例化httpclient - httpclient = HttpClients.createDefault(); - requestConfig = RequestConfig.custom() - .setSocketTimeout( Constants.HTTP_SOCKET_TIMEOUT) - .setConnectTimeout( Constants.HTTP_CONNECT_TIMEOUT) - .setConnectionRequestTimeout( Constants.HTTP_CONNECT_REQUEST_TIMEOUT) - .build(); - httpclient = HttpClients.custom().setDefaultRequestConfig(requestConfig) - .setRetryHandler(new DefaultHttpRequestRetryHandler( Constants.HTTP_CONNECT_RETRY_TIMES, false)) - .build(); - response = httpclient.execute(httpget); - if(response.getStatusLine().getStatusCode()==HttpStatus.SC_OK){ - content = EntityUtils.toString(response.getEntity(),"utf-8"); - logger.info("获取流量统计数据成功,相应内容如下: " + content); - }else { - logger.error("获取消息失败,相应内容如下: " + content); - throw new ConnectException("流量统计服务接口连接错误"+content); + URIBuilder uriBuilder = new URIBuilder(destUrl); + System.err.println(uriBuilder); + url=uriBuilder.toString(); + logger.info("流量统计数据请求路径:"+url); + //创建连接 + WebTarget wt = ClientUtil.getWebTarger(url); + logger.info("getMsg url:"+url); + //获取响应结果 + Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON); + response= header.get(); + int status = response.getStatus(); + if (status == HttpStatus.SC_OK) { + result= response.readEntity(String.class); + //调用处理数据方法 + logger.info("获取消息成功,相应内容如下: " + result); + } else { + logger.error("获取消息失败,相应内容如下: " + result); + throw new ConnectException("流量统计服务接口连接错误"+result); } - } catch (Exception e) { + } catch (Exception e) { throw e; }finally { if (response != null) { try { response.close(); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } } - try { - httpclient.close(); - } catch (IOException e) { - e.printStackTrace(); - } } - return content; + return result; } /** @@ -120,7 +105,7 @@ public class HttpClientUtil { * @throws IOException * @throws ClientProtocolException */ - public String post(String url,Map params) throws ClientProtocolException, IOException{ +/* public String post(String url,Map params) throws ClientProtocolException, IOException{ //实例化httpClient CloseableHttpClient httpclient =null; //结果 @@ -173,7 +158,7 @@ public class HttpClientUtil { } } return content; - } + } */ /** * 处理patch请求. * @param url 请求路径 @@ -199,13 +184,9 @@ public class HttpClientUtil { httpclient = HttpClients.createDefault(); //实例化patch方法 HttpPatch httpPatch = new HttpPatch(url); - httpPatch.setHeader("Content-type", "application/json"); - httpPatch.setHeader("Charset", "utf-8"); - httpPatch.setHeader("Accept", "application/json"); - httpPatch.setHeader("Accept-Charset", "utf-8"); //提交的参数 // UrlEncodedFormEntity uefEntity = new UrlEncodedFormEntity(nvps, "UTF-8"); @@ -236,10 +217,12 @@ public class HttpClientUtil { e.printStackTrace(); } } - try { - httpclient.close(); - } catch (IOException e) { - e.printStackTrace(); + if (httpclient != null) { + try { + httpclient.close(); + } catch (IOException e) { + e.printStackTrace(); + } } } return content; diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 0c1855327..99d727908 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -845,7 +845,7 @@ public class BaseController { if (entry.getCfgId() != null) { params.put("searchCfgId", entry.getCfgId()); } - if (entry.getOrderBy() != null&&entry.getOrderBy()!="") { + if (StringUtils.isNotBlank(entry.getOrderBy())) { params.put("orderBy", entry.getOrderBy()); } } diff --git a/src/main/webapp/WEB-INF/views/log/manipulation/dkBehaviorList.jsp b/src/main/webapp/WEB-INF/views/log/manipulation/dkBehaviorList.jsp index 4788dcfee..720bd02e4 100644 --- a/src/main/webapp/WEB-INF/views/log/manipulation/dkBehaviorList.jsp +++ b/src/main/webapp/WEB-INF/views/log/manipulation/dkBehaviorList.jsp @@ -60,13 +60,13 @@ $(document).ready(function(){
- + <%-- --%> - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/appList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/appList.jsp index a66204b37..1c9f17097 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/appList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/appList.jsp @@ -52,7 +52,7 @@ $(document).ready(function(){
- + @@ -119,7 +119,7 @@ $(document).ready(function(){ - +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp index ab1df766e..5759046c7 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/dnsList.jsp @@ -50,13 +50,13 @@
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp index 1cc4458ee..3cd664614 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/ftpList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp index 3343cc60e..9f0033b74 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/httpKeyList.jsp @@ -70,13 +70,13 @@
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/httpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/httpList.jsp index fa8eac90b..869590051 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/httpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/httpList.jsp @@ -49,13 +49,13 @@
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/l2tpLogList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/l2tpLogList.jsp index 2778d31df..7f70a5e28 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/l2tpLogList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/l2tpLogList.jsp @@ -51,13 +51,13 @@
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mailList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mailList.jsp index 5db1181ba..fdd185d20 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mailList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mailList.jsp @@ -48,13 +48,13 @@
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmAvIpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmAvIpList.jsp index f8bfe7062..26770d74b 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmAvIpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmAvIpList.jsp @@ -51,13 +51,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmAvUrlList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmAvUrlList.jsp index c4474f3d4..11383fea8 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmAvUrlList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmAvUrlList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmFileDigestList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmFileDigestList.jsp index 51d652cbe..b5b97459e 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmFileDigestList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmFileDigestList.jsp @@ -51,13 +51,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmPicIpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmPicIpList.jsp index 2dfc6eadc..45a58fb4b 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmPicIpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmPicIpList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmPicUrlList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmPicUrlList.jsp index c856c2661..3c54b0dd4 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmPicUrlList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmPicUrlList.jsp @@ -52,11 +52,11 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmPornAudioSampleList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmPornAudioSampleList.jsp index 4b748be7e..936c933dd 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmPornAudioSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmPornAudioSampleList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp index 384abf5c9..424e810d4 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleAudioList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleAudioList.jsp index 067a267c3..bc6c97691 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleAudioList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleAudioList.jsp @@ -67,13 +67,13 @@
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleFaceList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleFaceList.jsp index d859a31b9..cb74747a8 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleFaceList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleFaceList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleLogoList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleLogoList.jsp index 91986d7c3..914e47346 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleLogoList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleLogoList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSamplePicList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSamplePicList.jsp index 40c882f3e..a23f4a536 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSamplePicList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSamplePicList.jsp @@ -51,13 +51,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleSpeakerList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleSpeakerList.jsp index 1c5fd3a93..628476b2e 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleSpeakerList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleSpeakerList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVideoList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVideoList.jsp index 87f593b61..8979ac207 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVideoList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVideoList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVoipList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVoipList.jsp index a1f5c9a16..b7629237c 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVoipList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmSampleVoipList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmVoipAccountList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmVoipAccountList.jsp index 79962e6c6..8fc16e78f 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmVoipAccountList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmVoipAccountList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmVoipIpList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmVoipIpList.jsp index 88364d7cd..37c4038e2 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmVoipIpList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmVoipIpList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/ntcStreamMedia.jsp b/src/main/webapp/WEB-INF/views/log/ntc/ntcStreamMedia.jsp index 6b5e817c1..298a8bc45 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/ntcStreamMedia.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/ntcStreamMedia.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/openVpnList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/openVpnList.jsp index d1c2e05e0..600edf5d8 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/openVpnList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/openVpnList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp index 2e597b2ed..581fd224a 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/p2pList.jsp @@ -49,33 +49,17 @@
- +
diff --git a/src/main/webapp/WEB-INF/views/log/ntc/pptpLogList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/pptpLogList.jsp index 66ff6fc6a..986f64264 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/pptpLogList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/pptpLogList.jsp @@ -50,13 +50,13 @@
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/sshList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/sshList.jsp index 4b9bc0a69..7e8522e04 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/sshList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/sshList.jsp @@ -52,13 +52,13 @@ $(document).ready(function(){
- + - + diff --git a/src/main/webapp/WEB-INF/views/log/ntc/sslLogList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/sslLogList.jsp index 4d67e2517..8e0f62768 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/sslLogList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/sslLogList.jsp @@ -51,13 +51,13 @@
- + - +