src/main/webapp/WEB-INF/dynamic_fragments/error.jsp

Sat, 16 May 2020 15:45:06 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 16 May 2020 15:45:06 +0200
changeset 53
6a8498291606
parent 47
57cfb94ab99f
child 55
1a3b998afba7
permissions
-rw-r--r--

fixes bug where displaying an error page for missing data source would also require that data source (error pages don't try to get database connections now)

also improves error pages in general

13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 <%--
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3
24
8137ec335416 updates copyright header
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
4 Copyright 2018 Mike Becker. All rights reserved.
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 Redistribution and use in source and binary forms, with or without
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 modification, are permitted provided that the following conditions are met:
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 1. Redistributions of source code must retain the above copyright
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 notice, this list of conditions and the following disclaimer.
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 2. Redistributions in binary form must reproduce the above copyright
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 notice, this list of conditions and the following disclaimer in the
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 documentation and/or other materials provided with the distribution.
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 --%>
39
e722861558bb fixes minor issues that were reported by default inspection
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
27 <%@page pageEncoding="UTF-8" %>
47
57cfb94ab99f projects can now be added and updated
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
28 <%@page import="de.uapcore.lightpit.Constants" %>
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
29 <%@page import="de.uapcore.lightpit.modules.ErrorModule" %>
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
31 <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
46
1574965c7dc7 fixes error pages and adds referer link to error page if it comes from the application
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
32 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
39
e722861558bb fixes minor issues that were reported by default inspection
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
33
47
57cfb94ab99f projects can now be added and updated
Mike Becker <universe@uap-core.de>
parents: 46
diff changeset
34 <c:set scope="page" var="baseHref" value="${requestScope[Constants.REQ_ATTR_BASE_HREF]}" />
53
6a8498291606 fixes bug where displaying an error page for missing data source would also require that data source (error pages don't try to get database connections now)
Mike Becker <universe@uap-core.de>
parents: 47
diff changeset
35 <c:set scope="page" var="errorCode" value="${requestScope['javax.servlet.error.status_code']}"/>
46
1574965c7dc7 fixes error pages and adds referer link to error page if it comes from the application
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
36 <c:set scope="page" var="returnLink" value="${requestScope[ErrorModule.REQ_ATTR_RETURN_LINK]}"/>
13
f4608ad6c947 adds dynamic fragments to LightPIT request handling framework + basic language recognition code
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
38 <div id="error-page">
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
39 <h1><fmt:message key="h1"/></h1>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
40 <table>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
41 <tr>
39
e722861558bb fixes minor issues that were reported by default inspection
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
42 <th><fmt:message key="errorCode"/>:</th>
53
6a8498291606 fixes bug where displaying an error page for missing data source would also require that data source (error pages don't try to get database connections now)
Mike Becker <universe@uap-core.de>
parents: 47
diff changeset
43 <td>${errorCode} - <fmt:message key="code.${errorCode}" /></td>
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
44 </tr>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
45 <tr>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
46 <th><fmt:message key="errorMessage" />:</th>
53
6a8498291606 fixes bug where displaying an error page for missing data source would also require that data source (error pages don't try to get database connections now)
Mike Becker <universe@uap-core.de>
parents: 47
diff changeset
47 <td><c:out value="${requestScope['javax.servlet.error.message']}"/></td>
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
48 </tr>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
49 <tr>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
50 <th><fmt:message key="errorTimestamp" />:</th>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
51 <td><fmt:formatDate type="both" value="<%= new java.util.Date()%>"/></td>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
52 </tr>
46
1574965c7dc7 fixes error pages and adds referer link to error page if it comes from the application
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
53 <%--@elvariable id="exception" type="java.lang.Exception"--%>
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
54 <c:if test="${not empty exception}">
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
55 <tr>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
56 <th><fmt:message key="errorExceptionText" />:</th>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
57 <td>${exception.class.name} - ${exception.message}</td>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
58 </tr>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
59 </c:if>
46
1574965c7dc7 fixes error pages and adds referer link to error page if it comes from the application
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
60 <c:if test="${fn:startsWith(returnLink, baseHref)}">
1574965c7dc7 fixes error pages and adds referer link to error page if it comes from the application
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
61 <tr>
1574965c7dc7 fixes error pages and adds referer link to error page if it comes from the application
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
62 <th><fmt:message key="errorReturnLink" />:</th>
1574965c7dc7 fixes error pages and adds referer link to error page if it comes from the application
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
63 <td><a href="${returnLink}">${returnLink}</a></td>
1574965c7dc7 fixes error pages and adds referer link to error page if it comes from the application
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
64 </tr>
1574965c7dc7 fixes error pages and adds referer link to error page if it comes from the application
Mike Becker <universe@uap-core.de>
parents: 39
diff changeset
65 </c:if>
18
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
66 </table>
a94b172c3a93 user friendly error pages for codes 404, 403 and 500
Mike Becker <universe@uap-core.de>
parents: 15
diff changeset
67 </div>

mercurial