500.jsp
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<%--
Created by IntelliJ IDEA.
User: lq
Date: 2016/12/1/0001
Time: 14:05
To change this template use File | Settings | File Templates.
--%>
<%@ page import="org.nutz.lang.Strings"%>
<%@ page import="java.util.Enumeration"%>
<%@ page import="java.io.ByteArrayOutputStream"%>
<%@ page import="java.io.PrintWriter"%>
<%@ page import="org.nutz.mvc.Mvcs"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" isErrorPage="true" trimDirectiveWhitespaces="true"
session="false"%>
<% response.setStatus(500); %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>出错啦</title>
</head>
<body>
<div>
<%
Throwable e = exception;
if (e == null) {
Object obj = request.getAttribute("obj");
if (obj != null && obj instanceof Throwable) {
e = (Throwable)obj;
} else {
if (Mvcs.getActionContext() != null) {
e = Mvcs.getActionContext().getError();
}
}
}
%>
<h2>请求的路径: <%=(request.getAttribute("javax.servlet.forward.request_uri") + (request.getQueryString() == null ? "" : "?" + request.getQueryString())) %></h2><p/>
<%
if (Mvcs.getActionContext() != null) {
%>
<h2>请求的方法: <%=Mvcs.getActionContext().getMethod() %></h2><p/>
<%
}
if (e != null) {
%>
<h2>异常堆栈如下:</h2><p/>
<pre>
<code class="lang-java">
<%
ByteArrayOutputStream bao = new ByteArrayOutputStream();
PrintWriter pw = new PrintWriter(bao);
e.printStackTrace(pw);
pw.flush();
%>
<%=Strings.escapeHtml(new String(bao.toByteArray())) %>
</code>
</pre>
<%
}
%>
</div>
</body>
</html>