1 /* |
1 /* |
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
3 * |
3 * |
4 * Copyright 2018 Mike Becker. All rights reserved. |
4 * Copyright 2021 Mike Becker. All rights reserved. |
5 * |
5 * |
6 * Redistribution and use in source and binary forms, with or without |
6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are met: |
7 * modification, are permitted provided that the following conditions are met: |
8 * |
8 * |
9 * 1. Redistributions of source code must retain the above copyright |
9 * 1. Redistributions of source code must retain the above copyright |
45 ) |
45 ) |
46 public final class ErrorModule extends AbstractServlet { |
46 public final class ErrorModule extends AbstractServlet { |
47 |
47 |
48 public static final String REQ_ATTR_RETURN_LINK = "returnLink"; |
48 public static final String REQ_ATTR_RETURN_LINK = "returnLink"; |
49 |
49 |
50 @Override |
|
51 protected String getResourceBundleName() { |
|
52 return "localization.error"; |
|
53 } |
|
54 |
|
55 @RequestMapping(requestPath = "generic", method = HttpMethod.GET) |
50 @RequestMapping(requestPath = "generic", method = HttpMethod.GET) |
56 public void onError(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { |
51 public void onError(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { |
57 Optional.ofNullable(req.getHeader("Referer")).ifPresent( |
52 Optional.ofNullable(req.getHeader("Referer")).ifPresent( |
58 referer -> req.setAttribute(REQ_ATTR_RETURN_LINK, referer) |
53 referer -> req.setAttribute(REQ_ATTR_RETURN_LINK, referer) |
59 ); |
54 ); |