类 PathPatternRouteMatcher
- java.lang.Object
- org.springframework.web.util.pattern.PathPatternRouteMatcher
- 所有已实现的接口:
RouteMatcher
public class PathPatternRouteMatcher extends Object implements RouteMatcher
RouteMatcher
built onPathPatternParser
that usesPathContainer
andPathPattern
as parsed representations of routes and patterns.- 从以下版本开始:
- 5.2
- 作者:
- Rossen Stoyanchev
嵌套类概要
从接口继承的嵌套类/接口 org.springframework.util.RouteMatcher
RouteMatcher.Route
构造器概要
构造器 构造器 说明 PathPatternRouteMatcher()
Default constructor withPathPatternParser
customized forMESSAGE_ROUTE
and without matching of trailing separator.PathPatternRouteMatcher(PathPatternParser parser)
Constructor with givenPathPatternParser
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 String
combine(String pattern1, String pattern2)
Combines two patterns into a single pattern.Comparator<String>
getPatternComparator(RouteMatcher.Route route)
Given a route, return aComparator
suitable for sorting patterns in order of explicitness for that route, so that more specific patterns come before more generic ones.boolean
isPattern(String route)
Whether the givenroute
contains pattern syntax which requires theRouteMatcher.match(String, Route)
method, or if it is a regular String that could be compared directly to others.boolean
match(String pattern, RouteMatcher.Route route)
Match the given route against the given pattern.Map<String,String>
matchAndExtract(String pattern, RouteMatcher.Route route)
Match the pattern to the route and extract template variables.RouteMatcher.Route
parseRoute(String routeValue)
Return a parsed representation of the given route.
构造器详细资料
PathPatternRouteMatcher
public PathPatternRouteMatcher()
Default constructor withPathPatternParser
customized forMESSAGE_ROUTE
and without matching of trailing separator.
PathPatternRouteMatcher
public PathPatternRouteMatcher(PathPatternParser parser)
Constructor with givenPathPatternParser
.
方法详细资料
parseRoute
public RouteMatcher.Route parseRoute(String routeValue)
从接口复制的说明:RouteMatcher
Return a parsed representation of the given route.- 指定者:
parseRoute
在接口中RouteMatcher
- 参数:
routeValue
- the route to parse- 返回:
- the parsed representation of the route
isPattern
public boolean isPattern(String route)
从接口复制的说明:RouteMatcher
Whether the givenroute
contains pattern syntax which requires theRouteMatcher.match(String, Route)
method, or if it is a regular String that could be compared directly to others.- 指定者:
isPattern
在接口中RouteMatcher
- 参数:
route
- the route to check- 返回:
true
if the givenroute
represents a pattern
combine
public String combine(String pattern1, String pattern2)
从接口复制的说明:RouteMatcher
Combines two patterns into a single pattern.- 指定者:
combine
在接口中RouteMatcher
- 参数:
pattern1
- the first patternpattern2
- the second pattern- 返回:
- the combination of the two patterns
match
public boolean match(String pattern, RouteMatcher.Route route)
从接口复制的说明:RouteMatcher
Match the given route against the given pattern.- 指定者:
match
在接口中RouteMatcher
- 参数:
pattern
- the pattern to try to matchroute
- the route to test against- 返回:
true
if there is a match,false
otherwise
matchAndExtract
@Nullable public Map<String,String> matchAndExtract(String pattern, RouteMatcher.Route route)
从接口复制的说明:RouteMatcher
Match the pattern to the route and extract template variables.- 指定者:
matchAndExtract
在接口中RouteMatcher
- 参数:
pattern
- the pattern, possibly containing templates variablesroute
- the route to extract template variables from- 返回:
- a map with template variables and values
getPatternComparator
public Comparator<String> getPatternComparator(RouteMatcher.Route route)
从接口复制的说明:RouteMatcher
Given a route, return aComparator
suitable for sorting patterns in order of explicitness for that route, so that more specific patterns come before more generic ones.- 指定者:
getPatternComparator
在接口中RouteMatcher
- 参数:
route
- the full path to use for comparison- 返回:
- a comparator capable of sorting patterns in order of explicitness