1、添加 ntc 流量统计
2、修改监测设置修改页面 进程监测 pid文件,进程搜索关键字的非空校验 3、修改i18n 专用设备 为 串联设备 4、增加代理类,解决前端ajax 跨域问题,之后可能会用
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mail.jar"/>
|
||||
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/nis.jar"/>
|
||||
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/pinyin4j-2.5.0.jar"/>
|
||||
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/nutz-1.r.66.jar"/>
|
||||
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/nutz-1.r.66.jar" sourcepath="D:/jar包/nutz-1.r.66/nutz-1.r.66-sources.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -5110,7 +5110,7 @@ option_table.2.type_value=Unreachable
|
||||
option_table.10.type_value=Writable
|
||||
option_table.8.type_value=4 Alarm
|
||||
option_table.25.type_value=The data status is abnormal and exceeds the alarm value
|
||||
option_table.16.type_value=Dedicated Device
|
||||
option_table.16.type_value=Inline Device
|
||||
option_table.24.type_code=Over 2 monitoring cycles, no monitoring result information received
|
||||
option_table.27.type_code=Get The Node System Time Failed
|
||||
option_table.28.type_value=ADC-A016
|
||||
|
||||
@@ -4437,7 +4437,7 @@ option_table.2.type_value=\u041d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043
|
||||
option_table.10.type_value=\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0439
|
||||
option_table.8.type_value=\u0442\u0440\u0435\u0432\u043e\u0433\u0430 4 \u0443\u0440\u043e\u0432\u043d\u044f
|
||||
option_table.25.type_value=\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0432\u043e\u0433\u0438.
|
||||
option_table.16.type_value=\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0435
|
||||
option_table.16.type_value=Последовательное Устройство
|
||||
option_table.24.type_code=\u0411\u043e\u043b\u0435\u0435 \u0434\u0432\u0443\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u0432 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430
|
||||
option_table.27.type_code=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0443\u0437\u043b\u0430
|
||||
option_table.28.type_value=ADC-A016
|
||||
@@ -6532,4 +6532,4 @@ topoManage.TopoNameSetting=\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u04
|
||||
xt_mk_jbxx.604.mkmc=\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430
|
||||
xt_mk_jbxx.604.mkms=\u041c\u0435\u043d\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438
|
||||
pidFile.keyword.allblank=Процесс файл PID и процесс поиска ключевых слов не могут быть пустыми одновременно
|
||||
network.throughput=Network Throughput
|
||||
network.throughput=Пропускная Способность Сети
|
||||
@@ -5121,7 +5121,7 @@ option_table.2.type_value=\u4e0d\u53ef\u8fbe
|
||||
option_table.10.type_value=\u53ef\u5199
|
||||
option_table.8.type_value=4\u7ea7\u544a\u8b66
|
||||
option_table.25.type_value=\u6570\u636e\u72b6\u6001\u5f02\u5e38\uff0c\u8d85\u8fc7\u544a\u8b66\u503c
|
||||
option_table.16.type_value=\u4e13\u7528\u8bbe\u5907
|
||||
option_table.16.type_value=串联设备
|
||||
option_table.24.type_code=\u8d85\u8fc7 2 \u76d1\u6d4b\u5468\u671f\uff0c\u672a\u63a5\u6536\u5230\u76d1\u6d4b\u7ed3\u679c\u4fe1\u606f
|
||||
option_table.27.type_code=\u83b7\u53d6\u8be5\u8282\u70b9\u7cfb\u7edf\u65f6\u95f4\u5931\u8d25
|
||||
option_table.28.type_value=ADC-A016
|
||||
|
||||
@@ -477,10 +477,10 @@ html, body {
|
||||
<li><a href="<c:url value='/login!systemSelect.do?SytemChange=yes'/>">i18n_main.text.systemSelect_n81i |</a></li>
|
||||
<%-- <li><a href="<c:url value='/main.jsp?i18n_lang=zh_CN'/>">简体中文 |</a></li>
|
||||
<li><a href="<c:url value='/main.jsp?i18n_lang=en_US'/>">ENGLISH |</a></li> --%>
|
||||
<li <%=!"ALL".equals(systemname)?"style='display:none'":"" %>>
|
||||
<%-- <li <%=!"ALL".equals(systemname)?"style='display:none'":"" %>>
|
||||
<!-- <a href="<c:url value="/authentication/identificat.do?action=toTargetSys"/>">To Grafana |</a> -->
|
||||
<a href="<c:url value='/authentication/identificat.do?action=toTargetSys'/>" id="toTarget" target='_blank'>To Grafana |<a/>
|
||||
</li>
|
||||
</li> --%>
|
||||
<li>
|
||||
<span>
|
||||
<select id="languageChange">
|
||||
|
||||
@@ -127,7 +127,8 @@
|
||||
Chart.showLoading({text : "loading..."});
|
||||
var option = {
|
||||
title: {
|
||||
text: title ,left:"49%"
|
||||
text: title ,
|
||||
left:"center"
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
@@ -182,8 +183,10 @@
|
||||
var legengData = data.legend;
|
||||
$.ajax({//ajax请求获取数据
|
||||
type : "POST",
|
||||
url : influxdb.url,
|
||||
crossDomain:true,//请求偏向外域
|
||||
url : "<c:url value='/proxy.do'/>",
|
||||
headers:{
|
||||
realurl:influxdb.url
|
||||
},
|
||||
data:{
|
||||
db:data.db,//查询的数据库名
|
||||
q:data.q //查询语句
|
||||
|
||||
248
WebRoot/page/detection/monitorData/ntc.jsp
Normal file
248
WebRoot/page/detection/monitorData/ntc.jsp
Normal file
@@ -0,0 +1,248 @@
|
||||
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="/jstl/c" prefix="c"%>
|
||||
<%@ taglib uri="/jstl/fn" prefix="fn"%>
|
||||
<%@ taglib uri="/jstl/fmt" prefix="fmt"%>
|
||||
<%
|
||||
String path = request.getContextPath();
|
||||
String basePath = request.getScheme() + "://"
|
||||
+ request.getServerName() + ":" + request.getServerPort()
|
||||
+ path + "/";
|
||||
request.setAttribute("vEnter","\n");
|
||||
%>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>NTC</title>
|
||||
<link href="<c:url value='/css/nms.css'/>" rel="stylesheet" type="text/css" />
|
||||
<script language="javascript" type="text/javascript" src="<c:url value='/js/jquery1.11.3.js'/>"></script>
|
||||
<script language="javascript" type="text/javascript" src="<c:url value='/js/echarts.min.js'/>"></script>
|
||||
</head>
|
||||
<style>
|
||||
.section{
|
||||
margin: 30px 10px 30px 10px;
|
||||
float: left;
|
||||
width:100%;
|
||||
}
|
||||
.part{
|
||||
height: 400px;
|
||||
width: 50%;
|
||||
float: left;
|
||||
min-width: 600px;
|
||||
margin-top: 60px;
|
||||
}
|
||||
#template{
|
||||
display: none;
|
||||
}
|
||||
.addr{
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
font-weight:bold;
|
||||
padding: 5px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
}
|
||||
.pic{
|
||||
float: left;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var systemId = "${systemLogin}";//从session 中取出 systemId
|
||||
var refreshInterval = 30000;//定时数据间隔,单位:ms
|
||||
//数据源
|
||||
var influxdbSource = {
|
||||
"100000":{
|
||||
addr:"Astana",
|
||||
url:'http://10.0.5.19:8086/query'
|
||||
},
|
||||
"100001":{
|
||||
addr:"Almaty",
|
||||
url:"http://10.0.5.15:8086/query"
|
||||
}
|
||||
};
|
||||
//配置查询相关信息
|
||||
var queryInfo = {
|
||||
traffic : {
|
||||
title:'Throughputs (Gigabits per second)',
|
||||
//yAxisName:'packet/s',
|
||||
data: {
|
||||
legend:['Ether','TCP','UDP','IPv4','IPv6'],
|
||||
db:'ntc_stat',
|
||||
q:'SELECT sum("value_sum") /(1024*1024*1024)/30 FROM "[sapp]Ethernet_bps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /(1024*1024*1024)/30 FROM "[sapp]TCP_bps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /(1024*1024*1024)/30 FROM "[sapp]UDP_bps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /(1024*1024*1024)/30 FROM "[sapp]IPv4_bps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /(1024*1024*1024)/30 FROM "[sapp]IPv6_bps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value") /(1024*1024*1024)/30 FROM "[sapp]Unknown" WHERE time >= now() - 6h GROUP BY time(30s) fill(null)'
|
||||
}
|
||||
},
|
||||
packet :{
|
||||
title:'Throughputs (Packets per second)',
|
||||
//yAxisName:'conn/s',
|
||||
data:{
|
||||
legend:['TCP','UDP','Ether','IPv4','IPv6'],
|
||||
db:'ntc_stat',
|
||||
q:'SELECT sum("value_sum") /30 FROM "[sapp]TCP_pps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /30 FROM "[sapp]UDP_pps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /30 FROM "[sapp]Ethernet_pps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /30 FROM "[sapp]IPv4_pps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null);SELECT sum("value_sum") /30 FROM "[sapp]IPv6_pps" WHERE time >= now() - 6h GROUP BY time(30s) fill(null)'
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function renderChart(systemId){
|
||||
var influxdb = influxdbSource[systemId];
|
||||
var addr = influxdb.addr;
|
||||
var $templateClone = $("#template").clone();
|
||||
$templateClone.attr("id",systemId);
|
||||
$templateClone.find(".addr").html(addr);
|
||||
$("#container").append($templateClone);
|
||||
$.each(queryInfo,function(key,info){
|
||||
var $part = $templateClone.find("."+key);
|
||||
var title = info.title;
|
||||
var data = info.data;
|
||||
var yAxisName = info.yAxisName;
|
||||
var legengData = data.legend;
|
||||
var series = [];
|
||||
$.each(legengData,function(i,n){
|
||||
series.push({
|
||||
name: n,
|
||||
symbol:"none",
|
||||
type: 'line',
|
||||
data: []
|
||||
});
|
||||
});
|
||||
var Chart=echarts.init($part[0]);//初始化
|
||||
Chart.showLoading({text : "loading..."});
|
||||
var option = {
|
||||
title: {
|
||||
text: title ,
|
||||
left:"center"
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
formatter: function(params){
|
||||
var dateTime ;
|
||||
var result = "";
|
||||
$.each(params,function(i,n){
|
||||
console.log(n);
|
||||
if(!dateTime){
|
||||
dateTime = (new Date(n.value[0])).Format("yyyy-MM-dd hh:mm:ss");//n.value[0];
|
||||
}
|
||||
result += "<br/>" +n.marker + n.seriesName +": " + (n.value[1]?n.value[1].toFixed(0):"");
|
||||
});
|
||||
return dateTime + result;
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data:legengData,
|
||||
left:20,
|
||||
bottom:5
|
||||
},
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
timeFormat: 'hh:mm',
|
||||
splitNumber:6
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
name:yAxisName,
|
||||
nameLocation:"middle",
|
||||
nameTextStyle:{
|
||||
padding:30
|
||||
}
|
||||
},
|
||||
series: series
|
||||
};
|
||||
Chart.setOption(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//刷新数据
|
||||
function refreshData(){
|
||||
$("#container > .section").each(function(i,n){
|
||||
var $section = $(this);
|
||||
var systemId = $section.attr("id");
|
||||
var influxdb = influxdbSource[systemId];
|
||||
$.each(queryInfo,function(key,info){
|
||||
var $part = $section.find("."+key);
|
||||
var title = info.title;
|
||||
var data = info.data;
|
||||
var legengData = data.legend;
|
||||
$.ajax({//ajax请求获取数据
|
||||
type : "POST",
|
||||
url : influxdb.url,
|
||||
data:{
|
||||
db:data.db,//查询的数据库名
|
||||
q:data.q //查询语句
|
||||
},
|
||||
dataType : "json",
|
||||
success : function(data) {
|
||||
var results = data.results;//返回的result为json格式的数据
|
||||
var series = [];
|
||||
$.each(results, function(index, result) {
|
||||
var s = result["series"];
|
||||
var values = s ? s[0].values : [];
|
||||
series.push({
|
||||
name: legengData[index],
|
||||
type: 'line',
|
||||
data: values
|
||||
});
|
||||
});
|
||||
var Chart=echarts.getInstanceByDom($part[0]);//获取echarts实例
|
||||
Chart.showLoading({text : "loading..."});
|
||||
var option = { series: series };
|
||||
Chart.setOption(option);
|
||||
Chart.hideLoading();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
if(systemId == '-1'){//显示所有地区的图表
|
||||
$.each(influxdbSource,function(key,value){
|
||||
renderChart(key);
|
||||
});
|
||||
}else{//只显示当前登录的图表
|
||||
renderChart(systemId);
|
||||
}
|
||||
//首次加载数据
|
||||
refreshData();
|
||||
//定时刷新功能
|
||||
setInterval(function(){
|
||||
refreshData();
|
||||
}, refreshInterval);
|
||||
});
|
||||
|
||||
// 对Date的扩展,将 Date 转化为指定格式的String
|
||||
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
|
||||
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
|
||||
// 例子:
|
||||
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
|
||||
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
|
||||
Date.prototype.Format = function(fmt) { //author: meizz
|
||||
var o = {
|
||||
"M+" : this.getMonth()+1, //月份
|
||||
"d+" : this.getDate(), //日
|
||||
"h+" : this.getHours(), //小时
|
||||
"m+" : this.getMinutes(), //分
|
||||
"s+" : this.getSeconds(), //秒
|
||||
"q+" : Math.floor((this.getMonth()+3)/3), //季度
|
||||
"S" : this.getMilliseconds() //毫秒
|
||||
};
|
||||
if(/(y+)/.test(fmt))
|
||||
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
|
||||
for(var k in o)
|
||||
if(new RegExp("("+ k +")").test(fmt))
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
|
||||
return fmt;
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<div id="container" class="container"></div>
|
||||
<div id="template" class="section" >
|
||||
<div class="addr"></div>
|
||||
<div class="pic">
|
||||
<div class="part traffic"></div>
|
||||
<div class="part packet"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -104,31 +104,33 @@
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
if(Number(type) ==8){
|
||||
if(Number(type)==8){
|
||||
if(Number(type) > 7 && startType == 0){ // 手动启动
|
||||
if(false ==(
|
||||
$id("processFile","","i18n_udsi.message.processFile_n81i")
|
||||
&& $id("processSearchCode","","i18n_udsi.text.processSearchCode_n81i")
|
||||
$id("processFile","","i18n_adsi.message.processFile_n81i")
|
||||
|| $id("processSearchCode","","i18n_adsi.message.processSearchCodeTitle_n81i")
|
||||
)){
|
||||
alert("i18n_pidFile.keyword.allblank_n81i");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(Number(type) > 7 && startType == 1){ // 单次启动
|
||||
if(false ==(
|
||||
$id("processFile","","i18n_udsi.message.processFile_n81i")
|
||||
&& $id("processSearchCode","","i18n_udsi.text.processSearchCode_n81i")
|
||||
&& $id("processPath","","i18n_udsi.message.processPath_n81i")
|
||||
$id("processFile","","i18n_adsi.message.processFile_n81i")
|
||||
|| $id("processSearchCode","","i18n_adsi.message.processSearchCodeTitle_n81i")
|
||||
)){
|
||||
alert("i18n_pidFile.keyword.allblank_n81i");
|
||||
return;
|
||||
}else{
|
||||
if(! $id("processPath","","i18n_adsi.message.processPathTitle_n81i")){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Number(type) > 7 && startType == 2){ // 周期启动
|
||||
if(!$("#scriptFile").html()) { // 未上传脚本
|
||||
if(false ==(
|
||||
$id("myFile","","i18n_udsi.message.myFile_n81i")
|
||||
)){
|
||||
return;
|
||||
}
|
||||
if($("#myFile").val()==''){
|
||||
$("#myFile").next().html("i18n_adsi.message.myFile_n81i");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -602,7 +604,7 @@
|
||||
</td>
|
||||
<td class="color_3" colspan="3" align="left">
|
||||
<input type="text" name="detectionSetInfo.processFile" id="processFile" value="${detectionSetInfo.processFile}"/>
|
||||
<font color="red">*</font>
|
||||
<font color="red">* i18n_pidFile.keyword.allblank_n81i</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="csd">
|
||||
@@ -611,7 +613,7 @@
|
||||
</td>
|
||||
<td class="color_3" colspan="3" align="left">
|
||||
<input type="text" name="detectionSetInfo.processSearchCode" id="processSearchCode" value="${detectionSetInfo.processSearchCode}"/>
|
||||
<font color="red">*i18n_udsi.message.processSearchCode_n81i</font>
|
||||
<font color="red">* i18n_udsi.message.processSearchCode_n81i</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="dsd">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>i18n_nodeInfo.message.title_n81i</title>
|
||||
<title>${nodegroupTable.groupName } i18n_nodeInfo.message.title_n81i</title>
|
||||
<link href="<c:url value='/css/nms.css'/>" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="<c:url value='/css/suggest.css'/>" rel="stylesheet"
|
||||
|
||||
99
src/nis/nms/web/actions/ProxyAction.java
Normal file
99
src/nis/nms/web/actions/ProxyAction.java
Normal file
@@ -0,0 +1,99 @@
|
||||
package nis.nms.web.actions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.struts2.config.Result;
|
||||
import org.apache.struts2.config.Results;
|
||||
import org.nutz.http.Header;
|
||||
import org.nutz.http.Http;
|
||||
import org.nutz.http.Request;
|
||||
import org.nutz.http.Request.METHOD;
|
||||
import org.nutz.http.Response;
|
||||
import org.nutz.http.Sender;
|
||||
|
||||
import nis.nms.util.BaseAction;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@Results({
|
||||
@Result(name = "ok", value = "/main.jsp")
|
||||
})
|
||||
public class ProxyAction extends BaseAction {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String executeAction() throws Exception {
|
||||
InputStream is = null;
|
||||
try {
|
||||
String url = null;
|
||||
HttpServletRequest request = this.getRequest();
|
||||
Enumeration headerNames = request.getHeaderNames();
|
||||
Map<String,String> headerMap = new LinkedHashMap<String,String>();
|
||||
for(;headerNames.hasMoreElements();) {
|
||||
String element = (String) headerNames.nextElement();
|
||||
String value = request.getHeader(element);
|
||||
headerMap.put(element,value);
|
||||
}
|
||||
url = headerMap.get("realurl");
|
||||
Map parameterMap = request.getParameterMap();
|
||||
Header header = Header.create(headerMap);
|
||||
header = null;
|
||||
Request req = Request.create(url, getMethod(request.getMethod()), parameterMap, header);
|
||||
Response res = Sender.create(req).send();
|
||||
is = res.getStream();
|
||||
|
||||
HttpServletResponse response = this.getResponse();
|
||||
response.setStatus(res.getStatus());
|
||||
Header resHeader = res.getHeader();
|
||||
Set<Entry<String,String>> all = resHeader.getAll();
|
||||
for(Entry<String,String> entry : all) {
|
||||
String key = entry.getKey();
|
||||
if(key != null) {
|
||||
response.setHeader(key, entry.getValue());
|
||||
}
|
||||
}
|
||||
IOUtils.copy(is, response.getOutputStream());
|
||||
} finally {
|
||||
if(is != null) {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//GET, POST, OPTIONS, PUT, DELETE, TRACE, CONNECT, HEAD
|
||||
public static METHOD getMethod(String method) {
|
||||
METHOD result = null;
|
||||
switch (method.toUpperCase()) {
|
||||
case "GET":
|
||||
result = METHOD.GET; break;
|
||||
case "POST":
|
||||
result = METHOD.POST; break;
|
||||
case "OPTIONS":
|
||||
result = METHOD.OPTIONS; break;
|
||||
case "PUT":
|
||||
result = METHOD.PUT; break;
|
||||
case "DELETE":
|
||||
result = METHOD.DELETE; break;
|
||||
case "TRACE":
|
||||
result = METHOD.TRACE; break;
|
||||
case "CONNECT":
|
||||
result = METHOD.CONNECT; break;
|
||||
case "HEAD":
|
||||
result = METHOD.HEAD; break;
|
||||
default:
|
||||
result = METHOD.GET; break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -190,6 +190,8 @@ public class NodeManageAction extends BaseAction {
|
||||
|
||||
if (nodeGroupId != null) {// 指定组ID查找相应的节点
|
||||
hql += " and groupId =" + nodeGroupId + "";
|
||||
NodegroupTable nodegroupTable = (NodegroupTable) this.commonService.get(NodegroupTable.class, nodeGroupId);
|
||||
this.getRequest().setAttribute("nodegroupTable", nodegroupTable);
|
||||
}
|
||||
hql += " order by nodeState asc,nodeCreatetime desc";
|
||||
sqlCondition += " order by node_state asc,Node_createtime desc";
|
||||
@@ -199,7 +201,7 @@ public class NodeManageAction extends BaseAction {
|
||||
|
||||
page = this.commonService.findByPage(hql, pageNo, pageSize);
|
||||
nodeList = (List<NodeTable>) page.getResult();
|
||||
|
||||
|
||||
for (NodeTable node : nodeList) {
|
||||
List syslist = this.commonService
|
||||
.find("from SystemTable where systemId = "
|
||||
|
||||
Reference in New Issue
Block a user