Merge pull request #3853 from pedroigor/RHSSO-767

[RHSSO-767] - Wrong implementation of Request.getRelativePath causing failures on Tomcat-like adapters
This commit is contained in:
Stian Thorgersen 2017-02-13 10:26:34 +01:00 committed by GitHub
commit e3a8bed5b2
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