Correctly decode URL coming into the Jolokia endpoint

fixes #869
This commit is contained in:
Christian Dupuis 2014-05-15 17:28:49 +02:00
parent f65af2d502
commit cf2b2df2c8

View File

@ -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;
}
}
}