From 3ecd7a5c0158682191ca2c523a9e20577de3eaa9 Mon Sep 17 00:00:00 2001 From: leebj Date: Mon, 9 Sep 2024 13:43:26 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=8A=A4=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webapp/WEB-INF/jsp/error/errorPage.jsp | 82 +++++++++++++++++++ .../webapp/WEB-INF/jsp/include/taglib.jsp | 4 + 2 files changed, 86 insertions(+) create mode 100644 src/main/webapp/WEB-INF/jsp/error/errorPage.jsp create mode 100644 src/main/webapp/WEB-INF/jsp/include/taglib.jsp diff --git a/src/main/webapp/WEB-INF/jsp/error/errorPage.jsp b/src/main/webapp/WEB-INF/jsp/error/errorPage.jsp new file mode 100644 index 00000000..6e662796 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/error/errorPage.jsp @@ -0,0 +1,82 @@ +<%@ page language="java" pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> +<%@ page import="java.util.HashMap, javax.servlet.http.HttpServletRequest, cokr.xit.foundation.data.Convert" %> +<%! private static final HashMap titles = new HashMap<>(); + + static { + titles.put("404", "Page Not Found"); + titles.put("sessionExpired", "Session Expired"); + titles.put("invalidSession", "Invalid Session"); + titles.put("accessDenied", "Access Denied"); + titles.put("500", "Server Error"); + } + + private static void setTitle(HttpServletRequest hreq) { + String status = Convert.toString(hreq.getAttribute("status")); + if (status == "") + status = "500"; + String title = titles.get(status); + if (title == null) + title = titles.get("500"); + hreq.setAttribute("title", title); + } +%> +<% setTitle(request); %> +<% + response.setContentType("application/json; charset=UTF-8"); + String stacktrace = (String)request.getAttribute("stacktrace"); + request.setAttribute("stacktrace", Convert.rntq(stacktrace)); +%>{ + "path": "${path}", + "failed": true, + "status": "${status}", + "title": "${title}", + "message": "${message}", + "description": "${description}", + "stacktrace": "${stacktrace}" +} +<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> + + + + + + +
+
+

${title} :(

+

죄송합니다. 😖

+

${message}

+ 처음으로 돌아가기 + 이전으로 돌아가기 +
+ " + alt="page-misc-error-light" + width="500" + class="img-fluid" + data-app-dark-img="illustrations/page-misc-error-dark.png" + data-app-light-img="illustrations/page-misc-error-light.png" + /> +
+
+
+ + + + + + + +
diff --git a/src/main/webapp/WEB-INF/jsp/include/taglib.jsp b/src/main/webapp/WEB-INF/jsp/include/taglib.jsp new file mode 100644 index 00000000..19a0e603 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/include/taglib.jsp @@ -0,0 +1,4 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false" +%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" +%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" +%><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> \ No newline at end of file