|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
|
* Copyright 2002-2022 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -31,7 +31,6 @@ import org.apache.commons.logging.LogFactory;
@@ -31,7 +31,6 @@ import org.apache.commons.logging.LogFactory;
|
|
|
|
|
|
|
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
import org.springframework.util.ClassUtils; |
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
import org.springframework.util.LinkedMultiValueMap; |
|
|
|
|
import org.springframework.util.MultiValueMap; |
|
|
|
|
@ -61,9 +60,6 @@ public class UrlPathHelper {
@@ -61,9 +60,6 @@ public class UrlPathHelper {
|
|
|
|
|
*/ |
|
|
|
|
public static final String PATH_ATTRIBUTE = UrlPathHelper.class.getName() + ".PATH"; |
|
|
|
|
|
|
|
|
|
static final boolean servlet4Present = |
|
|
|
|
ClassUtils.hasMethod(HttpServletRequest.class, "getHttpServletMapping"); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Special WebSphere request attribute, indicating the original request URI. |
|
|
|
|
* Preferable over the standard Servlet 2.4 forward attribute on WebSphere, |
|
|
|
|
@ -266,10 +262,12 @@ public class UrlPathHelper {
@@ -266,10 +262,12 @@ public class UrlPathHelper {
|
|
|
|
|
* or if the servlet has been mapped to root; {@code false} otherwise |
|
|
|
|
*/ |
|
|
|
|
private boolean skipServletPathDetermination(HttpServletRequest request) { |
|
|
|
|
if (servlet4Present) { |
|
|
|
|
return Servlet4Delegate.skipServletPathDetermination(request); |
|
|
|
|
HttpServletMapping mapping = (HttpServletMapping) request.getAttribute(RequestDispatcher.INCLUDE_MAPPING); |
|
|
|
|
if (mapping == null) { |
|
|
|
|
mapping = request.getHttpServletMapping(); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
MappingMatch match = mapping.getMappingMatch(); |
|
|
|
|
return (match != null && (!match.equals(MappingMatch.PATH) || mapping.getPattern().equals("/*"))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -767,21 +765,4 @@ public class UrlPathHelper {
@@ -767,21 +765,4 @@ public class UrlPathHelper {
|
|
|
|
|
rawPathInstance.setReadOnly(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Inner class to avoid a hard dependency on Servlet 4 {@link HttpServletMapping} |
|
|
|
|
* and {@link MappingMatch} at runtime. |
|
|
|
|
*/ |
|
|
|
|
private static class Servlet4Delegate { |
|
|
|
|
|
|
|
|
|
public static boolean skipServletPathDetermination(HttpServletRequest request) { |
|
|
|
|
HttpServletMapping mapping = (HttpServletMapping) request.getAttribute(RequestDispatcher.INCLUDE_MAPPING); |
|
|
|
|
if (mapping == null) { |
|
|
|
|
mapping = request.getHttpServletMapping(); |
|
|
|
|
} |
|
|
|
|
MappingMatch match = mapping.getMappingMatch(); |
|
|
|
|
return (match != null && (!match.equals(MappingMatch.PATH) || mapping.getPattern().equals("/*"))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|