|
|
|
@ -66,8 +66,6 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private Object rootHandler; |
|
|
|
private Object rootHandler; |
|
|
|
|
|
|
|
|
|
|
|
private boolean useTrailingSlashMatch = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean lazyInitHandlers = false; |
|
|
|
private boolean lazyInitHandlers = false; |
|
|
|
|
|
|
|
|
|
|
|
private final Map<String, Object> handlerMap = new LinkedHashMap<>(); |
|
|
|
private final Map<String, Object> handlerMap = new LinkedHashMap<>(); |
|
|
|
@ -101,28 +99,6 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i |
|
|
|
return this.rootHandler; |
|
|
|
return this.rootHandler; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Whether to match to URLs irrespective of the presence of a trailing slash. |
|
|
|
|
|
|
|
* If enabled a URL pattern such as "/users" also matches to "/users/". |
|
|
|
|
|
|
|
* <p>The default value is {@code false}. |
|
|
|
|
|
|
|
* @deprecated as of 6.0, see |
|
|
|
|
|
|
|
* {@link PathPatternParser#setMatchOptionalTrailingSeparator(boolean)} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Deprecated(since = "6.0") |
|
|
|
|
|
|
|
public void setUseTrailingSlashMatch(boolean useTrailingSlashMatch) { |
|
|
|
|
|
|
|
this.useTrailingSlashMatch = useTrailingSlashMatch; |
|
|
|
|
|
|
|
if (getPatternParser() != null) { |
|
|
|
|
|
|
|
getPatternParser().setMatchOptionalTrailingSeparator(useTrailingSlashMatch); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Whether to match to URLs irrespective of the presence of a trailing slash. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean useTrailingSlashMatch() { |
|
|
|
|
|
|
|
return this.useTrailingSlashMatch; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set whether to lazily initialize handlers. Only applicable to |
|
|
|
* Set whether to lazily initialize handlers. Only applicable to |
|
|
|
* singleton handlers, as prototypes are always lazily initialized. |
|
|
|
* singleton handlers, as prototypes are always lazily initialized. |
|
|
|
@ -360,11 +336,6 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i |
|
|
|
if (getPathMatcher().match(registeredPattern, lookupPath)) { |
|
|
|
if (getPathMatcher().match(registeredPattern, lookupPath)) { |
|
|
|
matchingPatterns.add(registeredPattern); |
|
|
|
matchingPatterns.add(registeredPattern); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (useTrailingSlashMatch()) { |
|
|
|
|
|
|
|
if (!registeredPattern.endsWith("/") && getPathMatcher().match(registeredPattern + "/", lookupPath)) { |
|
|
|
|
|
|
|
matchingPatterns.add(registeredPattern + "/"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String bestMatch = null; |
|
|
|
String bestMatch = null; |
|
|
|
@ -495,11 +466,6 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i |
|
|
|
if (getPathMatcher().match(pattern, lookupPath)) { |
|
|
|
if (getPathMatcher().match(pattern, lookupPath)) { |
|
|
|
return new RequestMatchResult(pattern, lookupPath, getPathMatcher()); |
|
|
|
return new RequestMatchResult(pattern, lookupPath, getPathMatcher()); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (useTrailingSlashMatch()) { |
|
|
|
|
|
|
|
if (!pattern.endsWith("/") && getPathMatcher().match(pattern + "/", lookupPath)) { |
|
|
|
|
|
|
|
return new RequestMatchResult(pattern + "/", lookupPath, getPathMatcher()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|