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 TypeMethodDescriptionboolean
Does the givenpath
represent a pattern that can be matched by an implementation of this interface?boolean
Match the givenpath
against the givenpattern
, according to this PathMatcher's matching strategy.boolean
matchStart
(String pattern, String path) Match the givenpath
against the corresponding part of the givenpattern
, according to this PathMatcher's matching strategy.
-
Method Details
-
isPattern
Does the givenpath
represent 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:
true
if the givenpath
represents a pattern
-
match
Match the givenpath
against the givenpattern
, according to this PathMatcher's matching strategy.- Parameters:
pattern
- the pattern to match againstpath
- the path to test- Returns:
true
if the suppliedpath
matched,false
if it didn't
-
matchStart
Match the givenpath
against 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:
true
if the suppliedpath
matched,false
if it didn't
-