类 PathPatternsRequestCondition
java.lang.Object
cn.taketoday.web.handler.condition.AbstractRequestCondition<PathPatternsRequestCondition>
cn.taketoday.web.handler.condition.PathPatternsRequestCondition
- 所有已实现的接口:
RequestCondition<PathPatternsRequestCondition>
public final class PathPatternsRequestCondition
extends AbstractRequestCondition<PathPatternsRequestCondition>
A logical disjunction (' || ') request condition that matches a request
against a set of URL path patterns.
- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
-
字段概要
字段修饰符和类型字段说明private static final SortedSet<PathPattern>private final SortedSet<PathPattern>private static final SortedSet<PathPattern> -
构造器概要
构造器限定符构造器说明Default constructor resulting in an""(empty path) mapping.PathPatternsRequestCondition(PathPatternParser parser, String... patterns) Constructor with patterns to use.privatePathPatternsRequestCondition(SortedSet<PathPattern> patterns) -
方法概要
修饰符和类型方法说明Combine the patterns of the current and of the other instances as follows: If only one instance has patterns, use those.intcompareTo(PathPatternsRequestCondition other, RequestContext request) Compare the two conditions based on the URL patterns they contain.protected Collection<PathPattern>Return the discrete items a request condition is composed of.Return the mapping paths that are not patterns.Return the first pattern.getMatchingCondition(RequestContext request) Checks if any of the patterns match the given request and returns an instance that is guaranteed to contain matching patterns, sorted.private SortedSet<PathPattern>getMatchingPatterns(PathContainer lookupPath) Return the patterns in this condition.Return thegetPatterns()mapped to Strings.protected StringThe notation to use when printing discrete items of content.booleanWhether the condition is the "" (empty path) mapping.private static SortedSet<PathPattern>parse(PathPatternParser parser, String... patterns) 从类继承的方法 cn.taketoday.web.handler.condition.AbstractRequestCondition
equals, hashCode, isEmpty, toString
-
字段详细资料
-
EMPTY_PATH_PATTERN
-
EMPTY_PATH
-
ROOT_PATH_PATTERNS
-
patterns
-
-
构造器详细资料
-
PathPatternsRequestCondition
public PathPatternsRequestCondition()Default constructor resulting in an""(empty path) mapping. -
PathPatternsRequestCondition
Constructor with patterns to use. -
PathPatternsRequestCondition
-
-
方法详细资料
-
parse
-
getPatterns
Return the patterns in this condition. If only the first (top) pattern is needed usegetFirstPattern(). -
getContent
从类复制的说明:AbstractRequestConditionReturn the discrete items a request condition is composed of.For example URL patterns, HTTP request methods, param expressions, etc.
- 指定者:
getContent在类中AbstractRequestCondition<PathPatternsRequestCondition>- 返回:
- a collection of objects (never
null)
-
getToStringInfix
从类复制的说明:AbstractRequestConditionThe notation to use when printing discrete items of content.For example
" || "for URL patterns or" && "for param expressions. -
getFirstPattern
Return the first pattern. -
isEmptyPathMapping
public boolean isEmptyPathMapping()Whether the condition is the "" (empty path) mapping. -
getDirectPaths
Return the mapping paths that are not patterns. -
getPatternValues
Return thegetPatterns()mapped to Strings. -
combine
Combine the patterns of the current and of the other instances as follows:- If only one instance has patterns, use those.
- If both have patterns, combine patterns from "this" instance with
patterns from the other instance via
PathPattern.combine(PathPattern). - If neither has patterns, use
""and"/"as root path patterns.
- 参数:
other- the condition to combine with.- 返回:
- a request condition instance that is the result of combining the two condition instances.
-
getMatchingCondition
Checks if any of the patterns match the given request and returns an instance that is guaranteed to contain matching patterns, sorted.- 参数:
request- the current request- 返回:
- the same instance if the condition contains no patterns;
or a new condition with sorted matching patterns;
or
nullif no patterns match.
-
getMatchingPatterns
-
compareTo
Compare the two conditions based on the URL patterns they contain. Patterns are compared one at a time, from top to bottom. If all compared patterns match equally, but one instance has more patterns, it is considered a closer match.It is assumed that both instances have been obtained via
getMatchingCondition(RequestContext)to ensure they contain only patterns that match the request and are sorted with the best matches on top.request- the current request context
-