public class AntPathMatcher extends Object implements PatternMatcher
PathMatcher implementation for Ant-style path patterns. Examples are provided below.
Part of this mapping code has been kindly borrowed from Apache Ant.
The mapping matches URLs using the following rules:
com/*.jsp- matches all
.jspfiles in the
com/**/test.jsp- matches all
test.jspfiles underneath the
org/apache/shiro/**/*.jsp- matches all
.jspfiles underneath the
N.B.: This class was borrowed (with much appreciation) from the Spring Framework with modifications. We didn't want to reinvent the wheel of great work they've done, but also didn't want to force every Shiro user to depend on Spring
As per the Apache 2.0 license, the original copyright notice and all author and copyright information have remained in tact.
|Modifier and Type||Field and Description|
Default path separator: "/"
|Constructor and Description|
|Modifier and Type||Method and Description|
Actually match the given
Given a pattern and a full path, determine the pattern-mapped part.
Set the path separator to use for pattern parsing.
public void setPathSeparator(String pathSeparator)
trueif the given
sourcematches the specified
pathagainst the given
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)
trueif the supplied
falseif it didn't
public String extractPathWithinPattern(String pattern, String path)
/docs/cvs/commit.html' and '
/docs/*' and '
/docs/cvs/*.html' and '
/docs/**' and '
/docs/**\/*.html' and '
/*.html' and '
*.html' and '
*' and '
match(java.lang.String, java.lang.String) returns
true for '
path', but does not enforce this.
Copyright © 2004–2019 The Apache Software Foundation. All rights reserved.