Merge branch '5.2.x'

This commit is contained in:
Juergen Hoeller
2020-08-25 16:21:00 +02:00
23 changed files with 79 additions and 74 deletions

View File

@@ -49,7 +49,7 @@ class DefaultRequestPath implements RequestPath {
}
private static PathContainer initContextPath(PathContainer path, @Nullable String contextPath) {
if (!StringUtils.hasText(contextPath) || "/".equals(contextPath)) {
if (!StringUtils.hasText(contextPath) || StringUtils.matchesCharacter(contextPath, '/')) {
return PathContainer.parsePath("");
}
@@ -58,7 +58,7 @@ class DefaultRequestPath implements RequestPath {
int length = contextPath.length();
int counter = 0;
for (int i=0; i < path.elements().size(); i++) {
for (int i = 0; i < path.elements().size(); i++) {
PathContainer.Element element = path.elements().get(i);
counter += element.value().length();
if (length == counter) {

View File

@@ -233,7 +233,7 @@ public class UrlPathHelper {
}
// Else, use path within current servlet mapping if applicable
String rest = getPathWithinServletMapping(request);
if (!"".equals(rest)) {
if (StringUtils.hasLength(rest)) {
return rest;
}
else {
@@ -415,7 +415,7 @@ public class UrlPathHelper {
if (contextPath == null) {
contextPath = request.getContextPath();
}
if ("/".equals(contextPath)) {
if (StringUtils.matchesCharacter(contextPath, '/')) {
// Invalid case, but happens for includes on Jetty: silently adapt it.
contextPath = "";
}