类 AntPathMatcher


  • public class AntPathMatcher
    extends Object
    shiro url 匹配算法工具
    • 字段详细资料

      • DEFAULT_PATH_SEPARATOR

        public static final String DEFAULT_PATH_SEPARATOR
        Default path separator: "/"
        另请参阅:
        常量字段值
    • 构造器详细资料

      • AntPathMatcher

        public AntPathMatcher()
    • 方法详细资料

      • setPathSeparator

        public void setPathSeparator​(String pathSeparator)
        Set the path separator to use for pattern parsing. Default is "/", as in Ant.
      • isPattern

        public boolean isPattern​(String path)
      • matches

        public boolean matches​(String pattern,
                               String source)
      • match

        public boolean match​(String pattern,
                             String path)
      • matchStart

        public boolean matchStart​(String pattern,
                                  String path)
      • doMatch

        protected boolean doMatch​(String pattern,
                                  String path,
                                  boolean fullMatch)
        Actually match the given path against the given pattern.
        参数:
        pattern - the pattern to match against
        path - the path String to test
        fullMatch - whether a full pattern match is required (else a pattern match as far as the given base path goes is sufficient)
        返回:
        true if the supplied path matched, false if it didn't
      • extractPathWithinPattern

        public String extractPathWithinPattern​(String pattern,
                                               String path)
        Given a pattern and a full path, determine the pattern-mapped part.

        For example:

        • '/docs/cvs/commit.html' and '/docs/cvs/commit.html -> ''
        • '/docs/*' and '/docs/cvs/commit -> 'cvs/commit'
        • '/docs/cvs/*.html' and '/docs/cvs/commit.html -> 'commit.html'
        • '/docs/**' and '/docs/cvs/commit -> 'cvs/commit'
        • '/docs/**\/*.html' and '/docs/cvs/commit.html -> 'cvs/commit.html'
        • '/*.html' and '/docs/cvs/commit.html -> 'docs/cvs/commit.html'
        • '*.html' and '/docs/cvs/commit.html -> '/docs/cvs/commit.html'
        • '*' and '/docs/cvs/commit.html -> '/docs/cvs/commit.html'

        Assumes that match(java.lang.String, java.lang.String) returns true for 'pattern' and 'path', but does not enforce this.