From 004528777f411e73b4b828b0edbe8aa9d14a3e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Daviet?= Date: Tue, 15 Nov 2016 11:19:56 +0100 Subject: [PATCH 1/2] Make ErrorPageFilter.getDescription protected Make `ErrorPageFilter#getDescription` `protected` instead of `private` to be able to customize the details for the request logged in case of an error. Fixes gh-7380 Closes gh-7393 --- .../org/springframework/boot/web/support/ErrorPageFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java b/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java index 484bc42d08..6610a22c33 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java @@ -185,7 +185,7 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry { request.getRequestDispatcher(path).forward(request, response); } - private String getDescription(HttpServletRequest request) { + protected String getDescription(HttpServletRequest request) { return "[" + request.getServletPath() + (request.getPathInfo() == null ? "" : request.getPathInfo()) + "]"; } From 12d9ebfc02338162ba99ccaa1640a8ce3c8a5efa Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 16 Nov 2016 13:59:45 -0800 Subject: [PATCH 2/2] Polish ErrorPageFilter.getDescription javadoc See gh-7393 --- .../springframework/boot/web/support/ErrorPageFilter.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java b/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java index 6610a22c33..19a612ec75 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/support/ErrorPageFilter.java @@ -185,6 +185,13 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry { request.getRequestDispatcher(path).forward(request, response); } + /** + * Return the description for the given request. By default this method will return a + * description based on the request {@code servletPath} and {@code pathInfo}. + * @param request the source request + * @return the description + * @since 1.5.0 + */ protected String getDescription(HttpServletRequest request) { return "[" + request.getServletPath() + (request.getPathInfo() == null ? "" : request.getPathInfo()) + "]";