url path matching class

AntPathMatcher
1, AntPathMatcher class URL matching rule is as follows
? Matches one character
* Matches zero or more characters
* * Matches zero or more directories
2, an example
  • / Trip / api / * x matches / trip / api / x, / trip / api / ax, / trip / api / abx; but does not match / trip / abc / x;
  • ? / Trip / a / a x match / trip / a / abx; but does not match / trip / a / ax, / trip / a / abcx
  • / ** / api / alie match / trip / api / alie, / trip / dax / api / alie; but does not match / trip / a / api
  • /**/*.htmlm matches all ending .htmlm path
 
AntPathMatcher path=new AntPathMatcher ();
path.matcher("/trip/api/*x","/trip/api/x");//为true
path.matcher ( "/ trip / api / x", "/ trip / api / abx"); // is false, there must be url / trip / api / x it is true

Guess you like

Origin www.cnblogs.com/afei1759/p/11355349.html