vpn cgi接口服务 报错信息调整
This commit is contained in:
@@ -744,10 +744,14 @@ public class ConfigServiceUtil {
|
||||
result= response.readEntity(String.class);
|
||||
logger.info("cgi info:"+result);
|
||||
}else{
|
||||
if(response!= null) {
|
||||
throw new MaatConvertException("<spring:message code=\"cgi_service_failed\"/>:"+response.readEntity(String.class));
|
||||
}else {
|
||||
throw new MaatConvertException("<spring:message code=\"cgi_service_failed\"/>");
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map = (Map<String, String>) JSON.parse(result);
|
||||
String error = map.get("error");
|
||||
if (!StringUtil.isEmpty(error)) {
|
||||
error=cgiError(error);
|
||||
throw new MaatConvertException(error);
|
||||
}else{
|
||||
throw new MaatConvertException(null);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -760,6 +764,28 @@ public class ConfigServiceUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static String cgiError(String error){
|
||||
String cgiError="";
|
||||
String er=error.toLowerCase().trim();
|
||||
String errors=Constants.CGI_ERROR;
|
||||
if(!StringUtil.isEmpty(errors)){
|
||||
String [] ers=errors.toLowerCase().split(",");
|
||||
for (int i = 0; i < ers.length; i++) {
|
||||
if(ers[i].trim().equals(er)){
|
||||
cgiError=error;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cgiError;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 配置全量更新指令下发
|
||||
* @param params
|
||||
|
||||
@@ -831,4 +831,8 @@ public final class Constants {
|
||||
* 时间格式化
|
||||
*/
|
||||
public static final String COMMON_TIME_FORMAT = "HH:mm:ss";
|
||||
/**
|
||||
* vpn cgi接口报错信息
|
||||
*/
|
||||
public static final String CGI_ERROR = Configurations.getStringProperty("cgiError","");;
|
||||
}
|
||||
|
||||
@@ -132,8 +132,8 @@ public class UserManageController extends BaseController{
|
||||
exUser=exUser.substring(0, exUser.length()-1);
|
||||
message+="<br/> "+msgProp.getProperty("user")+" "+exUser+" "+msgProp.getProperty("user_check");
|
||||
}
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes,"error",message);
|
||||
if(!StringUtil.isEmpty(e.getMessage())) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
}else {
|
||||
addMessage(redirectAttributes,"error",message);
|
||||
}
|
||||
@@ -274,10 +274,18 @@ public class UserManageController extends BaseController{
|
||||
|
||||
}
|
||||
} catch (MaatConvertException e) {
|
||||
addMessage(redirectAttributes,"error",message);
|
||||
if(!StringUtil.isEmpty(e.getMessage())) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
}else{
|
||||
addMessage(redirectAttributes,"error",message);
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/userManage/list";
|
||||
} catch (Exception e) {
|
||||
addMessage(redirectAttributes,"error",message);
|
||||
if(!StringUtil.isEmpty(e.getMessage())) {
|
||||
addMessage(redirectAttributes,"error",e.getMessage());
|
||||
}else{
|
||||
addMessage(redirectAttributes,"error",message);
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/userManage/list";
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/userManage/list";
|
||||
|
||||
@@ -623,3 +623,6 @@ deleteRegionToCommonGroup=v1/delCommonGroupRegion
|
||||
#\u6d41\u91cf\u7edf\u8ba1app\u8be6\u60c5\u8d8b\u52bf\u56feGbps.pps\u63a5\u53e3
|
||||
trafficAppPpsTrend=v1/trafficAppPpsTrend
|
||||
trafficAppBpsTrend=v1/trafficAppBpsTrend
|
||||
#vpn cgi error info
|
||||
cgiError=cannot connect to vpnserver,Connection to the server has failed,Specified object can not be found,Too many users,User already exists,Too many created users,The destination server is not a VPN server,The connection has been interrupted,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user