Interface PathMatcher
- All Known Implementing Classes:
AntPathMatcher
public interface PathMatcher
Strategy interface for
String-based path matching.
Used by {link org.springframework.core.io.support.PathMatchingResourcePatternResolver}, {link org.springframework.web.servlet.handler.AbstractUrlHandlerMapping}, and {link org.springframework.web.servlet.mvc.WebContentInterceptor}.
The default implementation is {link AntPathMatcher}, supporting the Ant-style pattern syntax.
- Since:
- 1.2
- Author:
- Juergen Hoeller see AntPathMatcher
-
Method Summary
Modifier and TypeMethodDescriptionbooleanDoes the givenpathrepresent a pattern that can be matched by an implementation of this interface?booleanMatch the givenpathagainst the givenpattern, according to this PathMatcher's matching strategy.booleanmatchStart(String pattern, String path) Match the givenpathagainst the corresponding part of the givenpattern, according to this PathMatcher's matching strategy.
-
Method Details
-
isPattern
Does the givenpathrepresent a pattern that can be matched by an implementation of this interface?If the return value is
false, then the {link #match} method does not have to be used because direct equality comparisons on the static path Strings will lead to the same result.- Parameters:
path- the path to check- Returns:
trueif the givenpathrepresents a pattern
-
match
Match the givenpathagainst the givenpattern, according to this PathMatcher's matching strategy.- Parameters:
pattern- the pattern to match againstpath- the path to test- Returns:
trueif the suppliedpathmatched,falseif it didn't
-
matchStart
Match the givenpathagainst the corresponding part of the givenpattern, according to this PathMatcher's matching strategy.Determines whether the pattern at least matches as far as the given base path goes, assuming that a full path may then match as well.
- Parameters:
pattern- the pattern to match againstpath- the path to test- Returns:
trueif the suppliedpathmatched,falseif it didn't
-