1.1 --- a/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java Sat May 09 15:19:21 2020 +0200 1.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java Sat May 09 17:01:29 2020 +0200 1.3 @@ -1,8 +1,8 @@ 1.4 /* 1.5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 1.6 - * 1.7 + * 1.8 * Copyright 2018 Mike Becker. All rights reserved. 1.9 - * 1.10 + * 1.11 * Redistribution and use in source and binary forms, with or without 1.12 * modification, are permitted provided that the following conditions are met: 1.13 * 1.14 @@ -24,15 +24,12 @@ 1.15 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.16 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 1.17 * POSSIBILITY OF SUCH DAMAGE. 1.18 - * 1.19 + * 1.20 */ 1.21 package de.uapcore.lightpit.modules; 1.22 1.23 -import de.uapcore.lightpit.LightPITModule; 1.24 -import de.uapcore.lightpit.AbstractLightPITServlet; 1.25 -import de.uapcore.lightpit.HttpMethod; 1.26 -import de.uapcore.lightpit.RequestMapping; 1.27 -import de.uapcore.lightpit.ResponseType; 1.28 +import de.uapcore.lightpit.*; 1.29 + 1.30 import javax.servlet.annotation.WebServlet; 1.31 import javax.servlet.http.HttpServletRequest; 1.32 import javax.servlet.http.HttpServletResponse; 1.33 @@ -51,28 +48,28 @@ 1.34 urlPatterns = "/error/*" 1.35 ) 1.36 public final class ErrorModule extends AbstractLightPITServlet { 1.37 - 1.38 + 1.39 public static final String REQ_ATTR_ERROR_CODE = "errorCode"; 1.40 - 1.41 + 1.42 private ResponseType handle(HttpServletRequest req, HttpServletResponse resp, int sc) { 1.43 - 1.44 + 1.45 req.setAttribute(REQ_ATTR_ERROR_CODE, sc); 1.46 setStylesheet(req, "error"); 1.47 setDynamicFragment(req, "error"); 1.48 - 1.49 + 1.50 return ResponseType.HTML_FULL; 1.51 } 1.52 - 1.53 + 1.54 @RequestMapping(requestPath = "404", method = HttpMethod.GET) 1.55 public ResponseType handle404(HttpServletRequest req, HttpServletResponse resp) { 1.56 return handle(req, resp, 404); 1.57 } 1.58 - 1.59 + 1.60 @RequestMapping(requestPath = "403", method = HttpMethod.GET) 1.61 public ResponseType handle403(HttpServletRequest req, HttpServletResponse resp) { 1.62 return handle(req, resp, 403); 1.63 } 1.64 - 1.65 + 1.66 @RequestMapping(requestPath = "500", method = HttpMethod.GET) 1.67 public ResponseType handle500(HttpServletRequest req, HttpServletResponse resp) { 1.68 return handle(req, resp, 500);