public class URLPattern extends Object implements Comparable
Modifier and Type | Field and Description |
---|---|
protected org.apache.oro.text.regex.Pattern |
compiledPattern |
protected SecurityConstraint |
constraint |
protected String |
convertedPattern |
static int |
DEFAULT_TYPE
Pattern type for EXTENSION_TYPE mappings.
|
static int |
EXACT_TYPE
Pattern type for patterns that do not meet the specifications for the
other pattern types.
|
static int |
EXTENSION_TYPE
Pattern type for EXTENSION_TYPE mappings.
|
protected int |
order |
static int |
PATH_TYPE
Pattern type for PATH_TYPE mappings.
|
protected int |
pathLength |
protected String |
pattern |
protected int |
patternType |
protected WebResourceCollection |
resourceCollection |
Constructor and Description |
---|
URLPattern(String pattern,
SecurityConstraint constraint,
WebResourceCollection resourceCollection,
int order,
org.apache.oro.text.regex.PatternCompiler compiler)
Construct a new URLPattern object.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object obj)
Compares this URLPattern to obj to support sorting.
|
boolean |
equals(Object obj)
Test if this pattern is equivalent to another pattern.
|
org.apache.oro.text.regex.Pattern |
getCompiledPattern()
Get the compiled version of this pattern.
|
int |
getOrder()
Get the order value for this pattern (the order in which it appeared in the config file).
|
int |
getPathLength()
Get the path length of the pattern.
|
String |
getPattern()
Get the url pattern to match.
|
int |
getPatternType()
Get the pattern type.
|
SecurityConstraint |
getSecurityConstraint()
Get the SecurityConstraint object associated with this pattern.
|
WebResourceCollection |
getWebResourceCollection()
Get the WebResourceCollection associated with this pattern.
|
protected void |
initCompiledPattern(org.apache.oro.text.regex.PatternCompiler compiler)
Initialize the compiledPattern protected member.
|
protected void |
initConvertedPattern()
Initialize the convertedPattern protected member.
|
protected void |
initPathLength()
Initialize the pathLength protected member.
|
protected void |
initPatternType()
Initialize the patternType protected member.
|
public static final int EXACT_TYPE
public static final int PATH_TYPE
public static final int EXTENSION_TYPE
public static final int DEFAULT_TYPE
protected String pattern
protected String convertedPattern
protected org.apache.oro.text.regex.Pattern compiledPattern
protected SecurityConstraint constraint
protected WebResourceCollection resourceCollection
protected int order
protected int patternType
protected int pathLength
public URLPattern(String pattern, SecurityConstraint constraint, WebResourceCollection resourceCollection, int order, org.apache.oro.text.regex.PatternCompiler compiler) throws Exception
pattern
- the url pattern to matchconstraint
- the SecurityConstraint associated with this patternresourceCollection
- the WebResourceCollection associated with this patternorder
- the order in which this pattern occurred in the configuration filecompiler
- a PatternCompiler to use to compile this url patternException
URLPatternFactory
public String getPattern()
public org.apache.oro.text.regex.Pattern getCompiledPattern()
public int getPatternType()
public int getPathLength()
Examples:
public SecurityConstraint getSecurityConstraint()
public int getOrder()
public WebResourceCollection getWebResourceCollection()
protected void initPatternType()
protected void initPathLength()
protected void initConvertedPattern()
protected void initCompiledPattern(org.apache.oro.text.regex.PatternCompiler compiler) throws Exception
compiler
- Exception
public boolean equals(Object obj)
public int compareTo(Object obj) throws ClassCastException
The sort order is dictated by the servlet spec. The ordering by type is: EXACT_TYPE PATH_TYPE EXTENTION_TYPE DEFAULT_TYPE Ordering among PATH_TYPE patterns is determined by path length, with the longer path coming first. If the path lengths are the same, or both patterns are of the same type other than PATH_TYPE, ordering is determined by the order in which the pattern appeared in the config file. Thanks to Chris Nokleberg for contributing code for this method.
compareTo
in interface Comparable
obj
- another URLPattern to compare toClassCastException
- thrown if obj is not a URLPattern instanceCopyright © 2020 B3Partners B.V.. All rights reserved.