Class WebRequestPattensRule
- java.lang.Object
-
- io.microsphere.spring.web.rule.AbstractWebRequestRule<java.lang.String>
-
- io.microsphere.spring.web.rule.WebRequestPattensRule
-
- All Implemented Interfaces:
WebRequestRule
public class WebRequestPattensRule extends AbstractWebRequestRule<java.lang.String>
WebRequestPatternsWebRequestRuleA logical disjunction (' || ') request condition that matches a request against a set of URL path patterns.
In contrast to PathPatternsRequestCondition which uses parsed
PathPatterns, this condition does String pattern matching viaAntPathMatcher.- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
org.springframework.web.servlet.mvc.condition.PatternsRequestCondition,org.springframework.web.reactive.result.condition.PatternsRequestCondition
-
-
Constructor Summary
Constructors Constructor Description WebRequestPattensRule(java.lang.String... patterns)Constructor with URL patterns which are prepended with "/" if necessary.WebRequestPattensRule(java.lang.String[] patterns, boolean useTrailingSlashMatch, org.springframework.util.PathMatcher pathMatcher)Variant ofWebRequestPattensRule(String...)with aPathMatcherand flag for matching trailing slashes.WebRequestPattensRule(java.lang.String[] patterns, org.springframework.util.PathMatcher pathMatcher, boolean useTrailingSlashMatch)Deprecated.WebRequestPattensRule(java.lang.String[] patterns, org.springframework.util.PathMatcher pathMatcher, boolean useSuffixPatternMatch, boolean useTrailingSlashMatch)Variant ofWebRequestPattensRule(String...)with aUrlPathHelperand aPathMatcher, and flags for matching with suffixes and trailing slashes.WebRequestPattensRule(java.lang.String[] patterns, org.springframework.util.PathMatcher pathMatcher, boolean useSuffixPatternMatch, boolean useTrailingSlashMatch, java.util.List<java.lang.String> fileExtensions)Variant ofWebRequestPattensRule(String...)with aUrlPathHelperand aPathMatcher, and flags for matching with suffixes and trailing slashes, along with specific extensions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Collection<java.lang.String>getContent()Return the discrete items a request condition is composed of.protected java.lang.StringgetMatchingPattern(java.lang.String pattern, java.lang.String lookupPath)java.util.List<java.lang.String>getMatchingPatterns(java.lang.String lookupPath)protected java.lang.StringgetToStringInfix()The notation to use when printing discrete items of content.booleanmatches(java.lang.String lookupPath)booleanmatches(org.springframework.web.context.request.NativeWebRequest request)-
Methods inherited from class io.microsphere.spring.web.rule.AbstractWebRequestRule
equals, hashCode, isEmpty, toString
-
-
-
-
Constructor Detail
-
WebRequestPattensRule
public WebRequestPattensRule(java.lang.String... patterns)
Constructor with URL patterns which are prepended with "/" if necessary.- Parameters:
patterns- 0 or more URL patterns; no patterns results in an empty path""mapping which matches all requests.
-
WebRequestPattensRule
public WebRequestPattensRule(java.lang.String[] patterns, boolean useTrailingSlashMatch, @Nullable org.springframework.util.PathMatcher pathMatcher)Variant ofWebRequestPattensRule(String...)with aPathMatcherand flag for matching trailing slashes.
-
WebRequestPattensRule
@Deprecated public WebRequestPattensRule(java.lang.String[] patterns, @Nullable org.springframework.util.PathMatcher pathMatcher, boolean useTrailingSlashMatch)Deprecated.Variant ofWebRequestPattensRule(String...)with aUrlPathHelperand aPathMatcher, and whether to match trailing slashes.As of 5.3 the path is obtained through the static method
UrlPathHelper.getResolvedLookupPath(javax.servlet.ServletRequest)and aUrlPathHelperdoes not need to be passed in.WebRequestPattensRule(String[], boolean, PathMatcher).
-
WebRequestPattensRule
public WebRequestPattensRule(java.lang.String[] patterns, @Nullable org.springframework.util.PathMatcher pathMatcher, boolean useSuffixPatternMatch, boolean useTrailingSlashMatch)Variant ofWebRequestPattensRule(String...)with aUrlPathHelperand aPathMatcher, and flags for matching with suffixes and trailing slashes.As of 5.3 the path is obtained through the static method
UrlPathHelper.getResolvedLookupPath(javax.servlet.ServletRequest)and aUrlPathHelperdoes not need to be passed in.
-
WebRequestPattensRule
public WebRequestPattensRule(java.lang.String[] patterns, @Nullable org.springframework.util.PathMatcher pathMatcher, boolean useSuffixPatternMatch, boolean useTrailingSlashMatch, @Nullable java.util.List<java.lang.String> fileExtensions)Variant ofWebRequestPattensRule(String...)with aUrlPathHelperand aPathMatcher, and flags for matching with suffixes and trailing slashes, along with specific extensions.- Parameters:
patterns-pathMatcher-useSuffixPatternMatch-useTrailingSlashMatch-fileExtensions-
-
-
Method Detail
-
getContent
protected java.util.Collection<java.lang.String> getContent()
Description copied from class:AbstractWebRequestRuleReturn the discrete items a request condition is composed of.For example URL patterns, HTTP request methods, param expressions, etc.
- Specified by:
getContentin classAbstractWebRequestRule<java.lang.String>- Returns:
- a collection of objects (never
null)
-
getToStringInfix
protected java.lang.String getToStringInfix()
Description copied from class:AbstractWebRequestRuleThe notation to use when printing discrete items of content.For example
" || "for URL patterns or" && "for param expressions.- Specified by:
getToStringInfixin classAbstractWebRequestRule<java.lang.String>
-
matches
public boolean matches(org.springframework.web.context.request.NativeWebRequest request)
-
matches
public boolean matches(java.lang.String lookupPath)
-
getMatchingPatterns
public java.util.List<java.lang.String> getMatchingPatterns(java.lang.String lookupPath)
-
getMatchingPattern
@Nullable protected java.lang.String getMatchingPattern(java.lang.String pattern, java.lang.String lookupPath)
-
-