Class PathPatternRouteMatcher
java.lang.Object
org.springframework.web.util.pattern.PathPatternRouteMatcher
- All Implemented Interfaces:
RouteMatcher
RouteMatcher built on PathPatternParser that uses
PathContainer and PathPattern as parsed representations of
routes and patterns.- Since:
- 5.2
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.util.RouteMatcher
RouteMatcher.Route -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor withPathPatternParsercustomized forMESSAGE_ROUTEand without matching of trailing separator.Constructor with givenPathPatternParser. -
Method Summary
Modifier and TypeMethodDescriptionCombines two patterns into a single pattern.Given a route, return aComparatorsuitable for sorting patterns in order of explicitness for that route, so that more specific patterns come before more generic ones.booleanWhether the givenroutecontains pattern syntax which requires theRouteMatcher.match(String, Route)method, or if it is a regular String that could be compared directly to others.booleanmatch(String pattern, RouteMatcher.Route route) Match the given route against the given pattern.matchAndExtract(String pattern, RouteMatcher.Route route) Match the pattern to the route and extract template variables.parseRoute(String routeValue) Return a parsed representation of the given route.
-
Constructor Details
-
PathPatternRouteMatcher
public PathPatternRouteMatcher()Default constructor withPathPatternParsercustomized forMESSAGE_ROUTEand without matching of trailing separator. -
PathPatternRouteMatcher
Constructor with givenPathPatternParser.
-
-
Method Details
-
parseRoute
Description copied from interface:RouteMatcherReturn a parsed representation of the given route.- Specified by:
parseRoutein interfaceRouteMatcher- Parameters:
routeValue- the route to parse- Returns:
- the parsed representation of the route
-
isPattern
Description copied from interface:RouteMatcherWhether the givenroutecontains pattern syntax which requires theRouteMatcher.match(String, Route)method, or if it is a regular String that could be compared directly to others.- Specified by:
isPatternin interfaceRouteMatcher- Parameters:
route- the route to check- Returns:
trueif the givenrouterepresents a pattern
-
combine
Description copied from interface:RouteMatcherCombines two patterns into a single pattern.- Specified by:
combinein interfaceRouteMatcher- Parameters:
pattern1- the first patternpattern2- the second pattern- Returns:
- the combination of the two patterns
-
match
Description copied from interface:RouteMatcherMatch the given route against the given pattern.- Specified by:
matchin interfaceRouteMatcher- Parameters:
pattern- the pattern to try to matchroute- the route to test against- Returns:
trueif there is a match,falseotherwise
-
matchAndExtract
Description copied from interface:RouteMatcherMatch the pattern to the route and extract template variables.- Specified by:
matchAndExtractin interfaceRouteMatcher- Parameters:
pattern- the pattern, possibly containing templates variablesroute- the route to extract template variables from- Returns:
- a map with template variables and values
-
getPatternComparator
Description copied from interface:RouteMatcherGiven a route, return aComparatorsuitable for sorting patterns in order of explicitness for that route, so that more specific patterns come before more generic ones.- Specified by:
getPatternComparatorin interfaceRouteMatcher- Parameters:
route- the full path to use for comparison- Returns:
- a comparator capable of sorting patterns in order of explicitness
-