Package org.apache.catalina.util
Class URLPattern
- java.lang.Object
-
- org.apache.catalina.util.URLPattern
-
- All Implemented Interfaces:
Comparable
public class URLPattern extends Object implements Comparable
- Author:
- Ron Monzillo
-
-
Field Summary
Fields Modifier and Type Field Description static int
PT_DEFAULT
static int
PT_EXACT
static int
PT_EXTENSION
static int
PT_PREFIX
-
Constructor Summary
Constructors Constructor Description URLPattern()
URLPattern(String urlPattern)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object object)
boolean
equals(Object object)
int
getPatternDepth()
boolean
implies(URLPattern urlPattern)
Does this pattern imply (that is, match) the argument pattern? This method follows the same rules (in the same order) as those used for mapping requests to servlets.static boolean
match(String originalPattern, String newPattern)
Minor utility method which instantiates a pattern before comparing it against another.int
patternType()
String
toString()
-
-
-
Field Detail
-
PT_DEFAULT
public static final int PT_DEFAULT
- See Also:
- Constant Field Values
-
PT_EXTENSION
public static final int PT_EXTENSION
- See Also:
- Constant Field Values
-
PT_PREFIX
public static final int PT_PREFIX
- See Also:
- Constant Field Values
-
PT_EXACT
public static final int PT_EXACT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
URLPattern
public URLPattern()
-
URLPattern
public URLPattern(String urlPattern)
-
-
Method Detail
-
patternType
public int patternType()
-
compareTo
public int compareTo(Object object)
- Specified by:
compareTo
in interfaceComparable
-
implies
public boolean implies(URLPattern urlPattern)
Does this pattern imply (that is, match) the argument pattern? This method follows the same rules (in the same order) as those used for mapping requests to servlets.Two URL patterns match if they are related as follows:
- their pattern values are String equivalent, or
- this pattern is the path-prefix pattern "/*", or
- this pattern is a path-prefix pattern (that is, it starts with "/" and ends with "/*") and the argument pattern starts with the substring of this pattern, minus its last 2 characters, and the next character of the argument pattern, if there is one, is "/", or
- this pattern is an extension pattern (that is, it starts with "*.") and the argument pattern ends with this pattern, or
- the reference pattern is the special default pattern, "/", which matches all argument patterns.
- Parameters:
urlPattern
- URLPattern whose path will be compared to this URLPattern- Returns:
- Whether the given URLPattern matches the present URLPattern.
-
getPatternDepth
public int getPatternDepth()
-
match
public static boolean match(String originalPattern, String newPattern)
Minor utility method which instantiates a pattern before comparing it against another.- Parameters:
originalPattern
- The pattern to compare againstnewPattern
- The pattern to compare- Returns:
-
-