1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
---|
2 | |
---|
3 | <%-- |
---|
4 | JSP used to display standard HTTP and caught Spring MVC errors. HTTP errors |
---|
5 | are configured to use this page in the web.xml file. They should use an HTTP |
---|
6 | get query string parameter named "message" that contains the message to be |
---|
7 | displayed to the user. MVC errors are configured within the Spring Bean |
---|
8 | setup and ExceptionHandler java code. |
---|
9 | |
---|
10 | isErrorPage="true" causes the Web container to define a new implicit variable |
---|
11 | named: "exception". |
---|
12 | |
---|
13 | Expressions: http://www.informit.com/articles/article.aspx?p=30946&seqNum=7 |
---|
14 | --%> |
---|
15 | |
---|
16 | <%@ page language="java"%> |
---|
17 | <%@ page isErrorPage="true"%> |
---|
18 | <%@ page isELIgnored="false"%> |
---|
19 | <%@ include file="../_taglibs.jsp"%> |
---|
20 | |
---|
21 | <c:set var="pageTitle" value="IBIS-PH Application Error"/> |
---|
22 | |
---|
23 | <% |
---|
24 | String errorMessage = request.getParameter("message"); |
---|
25 | if(errorMessage == null) errorMessage = (String)request.getSession().getAttribute("javax.servlet.error.message"); |
---|
26 | if(errorMessage == null) errorMessage = (String)request.getAttribute("javax.servlet.error.message"); |
---|
27 | if(errorMessage == null) errorMessage = "Could not get error message."; |
---|
28 | |
---|
29 | String errorURI = request.getParameter("uri"); |
---|
30 | if(errorURI == null) errorURI = (String)request.getSession().getAttribute ("javax.servlet.error.request_uri"); |
---|
31 | if(errorURI == null) errorURI = (String)request.getAttribute("javax.servlet.error.request_uri"); |
---|
32 | /* |
---|
33 | if(errorURI != null) |
---|
34 | { |
---|
35 | try {errorURI = org.ibisph.util.NetLib.encode(errorURI);} |
---|
36 | catch(Exception ex) {} |
---|
37 | } |
---|
38 | */ |
---|
39 | if(errorURI == null) errorMessage = "Could not get error URI."; |
---|
40 | |
---|
41 | String statusCode = ((Integer)request.getAttribute("javax.servlet.error.status_code")).toString(); |
---|
42 | if(statusCode == null) statusCode = "unknown"; |
---|
43 | |
---|
44 | /* |
---|
45 | Logging flag is set via the logging execption handler which may or may not |
---|
46 | be used. Even when used most of the time the error is still not caught in |
---|
47 | the Spring MVC framework as it is "view" related and does not manifest itself |
---|
48 | until the output stream has been opended with the view being streamed back. |
---|
49 | */ |
---|
50 | boolean wasExceptionLogged = (request.getAttribute("ErrorLoggedFlag") != null); |
---|
51 | if(!wasExceptionLogged) { |
---|
52 | org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger("error/detail.jsp"); |
---|
53 | logger.error( |
---|
54 | " Error - Code: " + statusCode |
---|
55 | + ", URI: " + errorURI |
---|
56 | + ", Message: " + errorMessage |
---|
57 | + ", Requester's IP: " + request.getRemoteAddr() |
---|
58 | , exception |
---|
59 | ); |
---|
60 | } |
---|
61 | |
---|
62 | // always return a 404 regardless of the actual error. This is for crawlers... |
---|
63 | try { |
---|
64 | response.setStatus(404); |
---|
65 | } |
---|
66 | catch(Exception e) { |
---|
67 | System.out.println("jsp/ErrorPage.jsp - Internal Error Setting Status Code, Exception: "+e); |
---|
68 | } |
---|
69 | %> |
---|
70 | |
---|
71 | |
---|
72 | <html lang="en"> |
---|
73 | |
---|
74 | <head> |
---|
75 | |
---|
76 | <%@ include file="_head.jsp"%> |
---|
77 | |
---|
78 | <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/ModalDialog.css"/> |
---|
79 | |
---|
80 | <script language="JavaScript" type="text/javascript" src="${pageContext.request.contextPath}/js/DocumentSize.js"></script> |
---|
81 | <script language="JavaScript" type="text/javascript" src="${pageContext.request.contextPath}/js/ModalDialog.js"></script> |
---|
82 | <script type="text/javascript"> |
---|
83 | window.onLoadEventManager.add(initializePage); |
---|
84 | |
---|
85 | var modalDialog = null; |
---|
86 | function initializePage() |
---|
87 | { |
---|
88 | modalDialog = new ModalDialog("modalDialog", "modalDialogContentContainer"); |
---|
89 | } |
---|
90 | </script> |
---|
91 | </head> |
---|
92 | |
---|
93 | <body><div id="page"> |
---|
94 | |
---|
95 | <%@ include file="_header.jsp"%> |
---|
96 | |
---|
97 | <div id="content" class="Error"><div class="Section"> |
---|
98 | <div class="Header"> |
---|
99 | <h1 title="HTTP Status Code: <%=statusCode%>">Error <%=statusCode%>: <%=errorMessage%></h1> |
---|
100 | </div> |
---|
101 | |
---|
102 | <div class="Content"> |
---|
103 | <%-- Removed 3/2012 due to script vulernability - even though not a real issue... |
---|
104 | <div class="Request"> |
---|
105 | The IBIS-PH system has experienced an internal error while trying to fulfill a request for:<br/> |
---|
106 | <%=errorURI%> |
---|
107 | </div><br/> |
---|
108 | --%> |
---|
109 | |
---|
110 | <%@ include file="_options.jsp"%> |
---|
111 | |
---|
112 | </div> |
---|
113 | <div class="Footer"></div> |
---|
114 | |
---|
115 | <a href="javascript:modalDialog.show()" title="Show Debugging Information" class="ShowDebug">Debug Info</a> |
---|
116 | |
---|
117 | <div id="modalDialog" class="ModalDialog"> |
---|
118 | <a href="javascript:modalDialog.hide()" title="Close" class="CloseBox"><img src="${pageContext.request.contextPath}/image/closebox.png"/></a> |
---|
119 | <div class="InnerCanvas"> |
---|
120 | <h2 class="TitleBar" style="margin-left: 0;">Detailed Debugging Information</h2> |
---|
121 | <div id="modalDialogContentContainer"> |
---|
122 | <table class="Info"> |
---|
123 | <tr class="Section"><th colspan="2">HTTP Error:</th></tr> |
---|
124 | <tr> |
---|
125 | <th class="Section">Status Code</th> |
---|
126 | <td><%=statusCode%></td> |
---|
127 | </tr> |
---|
128 | <tr> |
---|
129 | <th class="Section">Problem URI</th> |
---|
130 | <td><%=errorURI%></td> |
---|
131 | </tr> |
---|
132 | <tr> |
---|
133 | <th class="Section">Message</th> |
---|
134 | <td><%=errorMessage%></td> |
---|
135 | </tr> |
---|
136 | |
---|
137 | <%if(exception != null) { %> |
---|
138 | <tr class="Section"><th colspan="2">Exception Information:</th></tr> |
---|
139 | <tr> |
---|
140 | <th class="Section">Type</th> |
---|
141 | <td>${requestScope["javax.servlet.error.exception_type"]}</td> |
---|
142 | </tr> |
---|
143 | <tr> |
---|
144 | <th class="Section">Localized Message</th> |
---|
145 | <td><%=exception.getLocalizedMessage()%></td> |
---|
146 | </tr> |
---|
147 | <tr> |
---|
148 | <th class="Section">Stack Trace</th> |
---|
149 | <td><textarea rows="10" cols="90" wrap="off"><%exception.printStackTrace(new java.io.PrintWriter((java.io.Writer)out));%></textarea></td> |
---|
150 | </tr> |
---|
151 | <%}%> |
---|
152 | |
---|
153 | <tr class="Section"><th colspan="2">Request Information:</th></tr> |
---|
154 | <tr> |
---|
155 | <th class="Section">Remote Host</th> |
---|
156 | <td>${pageContext.request.remoteHost}</td> |
---|
157 | </tr> |
---|
158 | <tr> |
---|
159 | <th class="Section">Remote Addr</th> |
---|
160 | <td>${pageContext.request.remoteAddr}</td> |
---|
161 | </tr> |
---|
162 | <tr> |
---|
163 | <th class="Section">Local Addr</th> |
---|
164 | <td>${pageContext.request.localAddr}</td> |
---|
165 | </tr> |
---|
166 | <tr> |
---|
167 | <th class="Section">Remote User</th> |
---|
168 | <td>${pageContext.request.remoteUser}</td> |
---|
169 | </tr> |
---|
170 | <tr> |
---|
171 | <th class="Section">Web Scheme</th> |
---|
172 | <td>${pageContext.request.scheme}</td> |
---|
173 | </tr> |
---|
174 | <tr> |
---|
175 | <th class="Section">Protocol</th> |
---|
176 | <td>${pageContext.request.protocol}</td> |
---|
177 | </tr> |
---|
178 | <tr> |
---|
179 | <th class="Section">Content Type</th> |
---|
180 | <td>${pageContext.request.contentType}</td> |
---|
181 | </tr> |
---|
182 | <tr> |
---|
183 | <th class="Section">Request Context Path</th> |
---|
184 | <td>${pageContext.request.contextPath}</td> |
---|
185 | </tr> |
---|
186 | <tr> |
---|
187 | <th class="Section">Request Locale</th> |
---|
188 | <td>${pageContext.request.locale}</td> |
---|
189 | </tr> |
---|
190 | <tr> |
---|
191 | <th class="Section">Authorization Type</th> |
---|
192 | <td>${pageContext.request.authType}</td> |
---|
193 | </tr> |
---|
194 | <tr> |
---|
195 | <th class="Section">Character Encoding</th> |
---|
196 | <td>${pageContext.request.characterEncoding}</td> |
---|
197 | </tr> |
---|
198 | |
---|
199 | <tr class="Section"><th colspan="2">HTTP Headers:</th></tr> |
---|
200 | <c:forEach items='${header}' var='h'> |
---|
201 | <tr> |
---|
202 | <th class="Section">${h.key}</th> |
---|
203 | <td>${h.value}</td> |
---|
204 | </tr> |
---|
205 | </c:forEach> |
---|
206 | </table> |
---|
207 | |
---|
208 | </div> |
---|
209 | </div> |
---|
210 | </div> |
---|
211 | |
---|
212 | </div></div> |
---|
213 | |
---|
214 | <%@ include file="_footer.jsp"%> |
---|
215 | |
---|
216 | </div></body> |
---|
217 | </html> |
---|
218 | |
---|