[RHSSO-767] - Wrong implementation of Request.getRelativePath causing failures on Tomcat-like adapters

This commit is contained in:
Pedro Igor 2017-02-09 21:27:28 -02:00
parent 75909a0add
commit 9416ee7224
2 changed files with 18 additions and 2 deletions

View file

@ -67,7 +67,15 @@ public class ServletHttpFacade implements HttpFacade {
@Override
public String getRelativePath() {
return request.getServletPath();
String uri = request.getRequestURI();
String contextPath = request.getContextPath();
String servletPath = uri.substring(uri.indexOf(contextPath) + contextPath.length());
if ("".equals(servletPath)) {
servletPath = "/";
}
return servletPath;
}
@Override

View file

@ -80,7 +80,15 @@ public class CatalinaHttpFacade implements HttpFacade {
@Override
public String getRelativePath() {
return request.getServletPath();
String uri = request.getRequestURI();
String contextPath = request.getContextPath();
String servletPath = uri.substring(uri.indexOf(contextPath) + contextPath.length());
if ("".equals(servletPath)) {
servletPath = "/";
}
return servletPath;
}
@Override