From cf2b2df2c83c48f39bf09d9ff75d14049a6a0362 Mon Sep 17 00:00:00 2001 From: Christian Dupuis Date: Thu, 15 May 2014 17:28:49 +0200 Subject: [PATCH] Correctly decode URL coming into the Jolokia endpoint fixes #869 --- .../boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java index ae5b38d820..d0a586b7cc 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java @@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.context.ServletContextAware; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.ServletWrappingController; +import org.springframework.web.util.UrlPathHelper; /** * {@link MvcEndpoint} to expose Jolokia. @@ -124,15 +125,18 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, private static class PathStripper extends HttpServletRequestWrapper { private final String path; + private final UrlPathHelper urlPathHelper; public PathStripper(HttpServletRequest request, String path) { super(request); this.path = path; + this.urlPathHelper = new UrlPathHelper(); } @Override public String getPathInfo() { - String value = super.getRequestURI(); + String value = this.urlPathHelper.decodeRequestString( + (HttpServletRequest) getRequest(), super.getRequestURI()); if (value.contains(this.path)) { value = value.substring(value.indexOf(this.path) + this.path.length()); } @@ -145,6 +149,6 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, } return value; } - } + }