UrlPathHelper cuts off trailing servlet-path slashes for root mappings (on WebSphere; SPR-7052)

This commit is contained in:
Juergen Hoeller
2010-03-31 14:02:27 +00:00
parent c24bafd644
commit 20f4e9023b
3 changed files with 74 additions and 14 deletions

View File

@@ -18,7 +18,6 @@ package org.springframework.web.util;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
@@ -226,6 +225,10 @@ public class UrlPathHelper {
if (servletPath == null) {
servletPath = request.getServletPath();
}
if (servletPath.length() > 1 && servletPath.endsWith("/")) {
// Probably on WebSphere: removing trailing slash...
servletPath = servletPath.substring(0, servletPath.length() - 1);
}
return servletPath;
}