@@ -3,9 +3,23 @@ response.setStatus(400);
|
||||
|
||||
// 获取异常类
|
||||
Throwable ex = Exceptions.getThrowable(request);
|
||||
//获取国际化信息
|
||||
Properties msgProp = new Properties();
|
||||
try {
|
||||
String language = LocaleContextHolder.getLocale().getLanguage();
|
||||
if (language.equals("zh_cn") || language.equals("zh")) {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_zh_CN.properties"));
|
||||
} else if (language.equals("ru")) {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_ru.properties"));
|
||||
} else {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_en.properties"));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
msgProp = null;
|
||||
}
|
||||
// 编译错误信息
|
||||
StringBuilder sb = new StringBuilder("(400)<spring:message code=\"exception_info\"/>:\n");
|
||||
StringBuilder sb = new StringBuilder("(400)"+msgProp!=null?msgProp.getProperty("exception_info"):"Exception Infomation"+":\n");
|
||||
if (ex != null) {
|
||||
if (ex instanceof BindException) {
|
||||
for (ObjectError e : ((BindException)ex).getGlobalErrors()){
|
||||
@@ -24,7 +38,7 @@ if (ex != null) {
|
||||
sb.append("☆" + ex.getMessage());
|
||||
}
|
||||
} else {
|
||||
sb.append("<spring:message code=\"unkown_error\"/>.\n\n");
|
||||
sb.append(msgProp!=null?msgProp.getProperty("unkown_error"):"Unkown Error Infomation"+":\n\n");
|
||||
}
|
||||
|
||||
// 如果是异步请求或是手机端,则直接返回信息
|
||||
@@ -42,6 +56,9 @@ else {
|
||||
<%@page import="com.nis.web.security.Servlets"%>
|
||||
<%@page import="com.nis.util.Exceptions"%>
|
||||
<%@page import="com.nis.util.StringUtils"%>
|
||||
<%@page import="java.util.Properties"%>
|
||||
<%@page import="org.springframework.context.i18n.LocaleContextHolder"%>
|
||||
<%@page import="com.nis.util.Configurations"%>
|
||||
<%@page contentType="text/html;charset=UTF-8" isErrorPage="true"%>
|
||||
<%@include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<!DOCTYPE html>
|
||||
|
||||
@@ -3,13 +3,27 @@ response.setStatus(403);
|
||||
|
||||
//获取异常类
|
||||
Throwable ex = Exceptions.getThrowable(request);
|
||||
//获取国际化信息
|
||||
Properties msgProp = new Properties();
|
||||
try {
|
||||
String language = LocaleContextHolder.getLocale().getLanguage();
|
||||
if (language.equals("zh_cn") || language.equals("zh")) {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_zh_CN.properties"));
|
||||
} else if (language.equals("ru")) {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_ru.properties"));
|
||||
} else {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_en.properties"));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
msgProp = null;
|
||||
}
|
||||
// 如果是异步请求或是手机端,则直接返回信息
|
||||
if (Servlets.isAjaxRequest(request)) {
|
||||
if (ex!=null && StringUtils.startsWith(ex.getMessage(), "msg:")){
|
||||
out.print(StringUtils.replace(ex.getMessage(), "msg:", ""));
|
||||
}else{
|
||||
out.print("<spring:message code=\"no_permission\"/>.");
|
||||
out.print(msgProp!=null?msgProp.getProperty("no_permission"):"Lack of authority");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +33,9 @@ else {
|
||||
<%@page import="com.nis.web.security.Servlets"%>
|
||||
<%@page import="com.nis.util.Exceptions"%>
|
||||
<%@page import="com.nis.util.StringUtils"%>
|
||||
<%@page import="java.util.Properties"%>
|
||||
<%@page import="org.springframework.context.i18n.LocaleContextHolder"%>
|
||||
<%@page import="com.nis.util.Configurations"%>
|
||||
<%@page contentType="text/html;charset=UTF-8" isErrorPage="true"%>
|
||||
<%@include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<!DOCTYPE html>
|
||||
|
||||
@@ -1,15 +1,32 @@
|
||||
<%
|
||||
response.setStatus(404);
|
||||
//获取国际化信息
|
||||
Properties msgProp = new Properties();
|
||||
try {
|
||||
String language = LocaleContextHolder.getLocale().getLanguage();
|
||||
if (language.equals("zh_cn") || language.equals("zh")) {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_zh_CN.properties"));
|
||||
} else if (language.equals("ru")) {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_ru.properties"));
|
||||
} else {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_en.properties"));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
msgProp = null;
|
||||
}
|
||||
// 如果是异步请求或是手机端,则直接返回信息
|
||||
if (Servlets.isAjaxRequest(request)) {
|
||||
out.print("<spring:message code=\"notfound_page\"/>.");
|
||||
out.print(msgProp!=null?msgProp.getProperty("notfound_page"):"Page does not exist");
|
||||
}
|
||||
|
||||
//输出异常信息页面
|
||||
else {
|
||||
%>
|
||||
<%@page import="com.nis.web.security.Servlets"%>
|
||||
<%@page import="java.util.Properties"%>
|
||||
<%@page import="org.springframework.context.i18n.LocaleContextHolder"%>
|
||||
<%@page import="com.nis.util.Configurations"%>
|
||||
<%@page contentType="text/html;charset=UTF-8" isErrorPage="true"%>
|
||||
<%@include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<!DOCTYPE html>
|
||||
|
||||
@@ -6,13 +6,27 @@ Throwable ex = Exceptions.getThrowable(request);
|
||||
if (ex != null){
|
||||
LoggerFactory.getLogger("500.jsp").error(ex.getMessage(), ex);
|
||||
}
|
||||
//获取国际化信息
|
||||
Properties msgProp = new Properties();
|
||||
try {
|
||||
String language = LocaleContextHolder.getLocale().getLanguage();
|
||||
if (language.equals("zh_cn") || language.equals("zh")) {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_zh_CN.properties"));
|
||||
} else if (language.equals("ru")) {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_ru.properties"));
|
||||
} else {
|
||||
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_en.properties"));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
msgProp = null;
|
||||
}
|
||||
// 编译错误信息
|
||||
StringBuilder sb = new StringBuilder("<spring:message code=\"exception_info\"/>:\n");
|
||||
StringBuilder sb = new StringBuilder(msgProp!=null?msgProp.getProperty("exception_info")+":\n":"Exception Infomation:\n");
|
||||
if (ex != null) {
|
||||
sb.append(Exceptions.getStackTraceAsString(ex));
|
||||
} else {
|
||||
sb.append("<spring:message code=\"unkown_error\"/>.\n\n");
|
||||
sb.append(msgProp!=null?msgProp.getProperty("unkown_error")+":\n\n":"Unkown Error Infomation:\n");
|
||||
}
|
||||
|
||||
// 如果是异步请求或是手机端,则直接返回信息
|
||||
@@ -27,6 +41,9 @@ else {
|
||||
<%@page import="com.nis.web.security.Servlets"%>
|
||||
<%@page import="com.nis.util.Exceptions"%>
|
||||
<%@page import="com.nis.util.StringUtils"%>
|
||||
<%@page import="java.util.Properties"%>
|
||||
<%@page import="org.springframework.context.i18n.LocaleContextHolder"%>
|
||||
<%@page import="com.nis.util.Configurations"%>
|
||||
<%@page contentType="text/html;charset=UTF-8" isErrorPage="true"%>
|
||||
<%@include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<!DOCTYPE html>
|
||||
@@ -39,7 +56,7 @@ else {
|
||||
<div class="container-fluid">
|
||||
<div class="page-header"><h1>500-<spring:message code="system_error"/>.</h1></div>
|
||||
<div class="errorMessage">
|
||||
<spring:message code="exception_info"/>:<%=ex==null?"<spring:message code=\"unkown_error\"/>.":StringUtils.toHtml(ex.getMessage())%> <br/> <br/>
|
||||
<spring:message code="exception_info"/>:<%=ex==null?(msgProp!=null?msgProp.getProperty("exception_info")+":\n":"Exception Infomation:\n")+"\n":StringUtils.toHtml(ex.getMessage())%> <br/> <br/>
|
||||
<!-- 请点击“查看详细信息”按钮,将详细错误信息发送给系统管理员,谢谢! -->
|
||||
<spring:message code="click_detail"/><br/> <br/>
|
||||
<a href="javascript:" onclick="history.go(-1);" class="btn"><spring:message code="return_lastpage"/></a>
|
||||
|
||||
Reference in New Issue
Block a user