Browse Source

Correctly decode URL coming into the Jolokia endpoint

fixes #869
pull/965/head
Christian Dupuis 12 years ago
parent
commit
cf2b2df2c8
  1. 8
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java

8
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; @@ -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, @@ -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, @@ -145,6 +149,6 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
}
return value;
}
}
}

Loading…
Cancel
Save