From 397486c208ab9b9e24bfa846bafe8c875f0c6542 Mon Sep 17 00:00:00 2001 From: Kai Moritz <kai@juplo.de> Date: Fri, 28 Aug 2020 11:14:25 +0200 Subject: [PATCH] Customized the error-pages by adding a template --- src/main/resources/templates/error/error.html | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/main/resources/templates/error/error.html diff --git a/src/main/resources/templates/error/error.html b/src/main/resources/templates/error/error.html new file mode 100644 index 0000000..63ee50b --- /dev/null +++ b/src/main/resources/templates/error/error.html @@ -0,0 +1,60 @@ +<!doctype html> +<html xmlns:th="http://www.thymeleaf.org" lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <title>Shows Remote-Content</title> + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> + </head> + <body> + <nav class="navbar navbar-dark bg-primary navbar-expand navbar-dark flex-column"> + <h2 class="navbar-brand">Demo: Unit-Test or Integration-Test — A Practical Guide</h2> + </nav> + <main class="container mt-5"> + <div class="card"> + <div class="card-header" id="content"><h1 th:text="|${status}: ${error}">XXX: ERROR</h1></div> + <div class="card-body"> + <table class="card-text table"> + <tbody> + <tr class="border-top-0"> + <th scope="row">Status</th> + <td th:text="${status}">ERROR.STATUS</td> + </tr> + <tr> + <th scope="row">Error</th> + <td th:text="${error}">ERROR.ERROR</td> + </tr> + <tr th:if="!${#strings.isEmpty(message)}"> + <th scope="row">Message</th> + <td th:text="${message}">ERROR.MESSAGE</td> + </tr> + <tr th:if="!${#strings.isEmpty(requestId)}"> + <th class="text-nowrap" scope="row">Request-ID</th> + <td th:text="${requestId}">ERROR.REQUEST_ID</td> + </tr> + <tr> + <th scope="row">Timstamp</th> + <td th:text="${timestamp}">ERROR.TIMESTAMP</td> + </tr> + <tr th:if="!${#strings.isEmpty(path)}"> + <th scope="row">Path</th> + <td th:text="${path}">ERROR.PATH</td> + </tr> + <!--/**--> + <tr th:if="!${#strings.isEmpty(trace)}"> + <th scope="row">Trace</th> + <td> + <div class="overflow-hidden"> + <pre class="overflow-hidden" th:text="${trace}">ERROR.TRACE</pre> + </div> + </td> + </tr> + <!--**/--> + </tbody> + </table> + <a href="#" th:href="@{/}" class="btn btn-primary">Back to HOME</a> + </div> + </div> + </main> + </body> +</html> -- 2.20.1