public class UrlMap<E>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
UrlMap.Filter<X> |
Constructor and Description |
---|
UrlMap()
Create a new map
|
UrlMap(boolean bestShort)
Create a new map preferring a short match.
|
Modifier and Type | Method and Description |
---|---|
void |
addMap(java.lang.String pattern,
E value) |
void |
addMap(java.lang.String pattern,
E value,
boolean isIgnore) |
void |
addMap(java.lang.String pattern,
E value,
boolean isIgnore,
boolean ifAbsent) |
void |
addMap(java.lang.String pattern,
java.lang.String flags,
E value,
boolean isIgnore,
boolean ifAbsent)
Adds a new url-pattern and its corresponding value to the map
|
void |
addRegexp(int prefixLength,
java.lang.String regexp,
java.lang.String flags,
E value,
boolean isShort,
boolean isIgnore,
boolean ifAbsent)
Adds a regular expression to the map.
|
void |
addRegexp(int prefixLength,
java.lang.String pattern,
java.lang.String regexp,
java.lang.String flags,
E value,
boolean isShort,
boolean isIgnore,
boolean ifAbsent,
boolean isSimple)
Adds a regular expression to the map.
|
void |
addRegexp(java.lang.String regexp,
E value) |
void |
addRegexp(java.lang.String regexp,
java.lang.String flags,
E value) |
void |
addRegexpIfAbsent(java.lang.String regexp,
E value) |
void |
addStrictMap(java.lang.String pattern,
java.lang.String flags,
E value)
Adds a new url-pattern and its corresponding value to the map
|
java.util.ArrayList<java.lang.String> |
getURLPatterns()
Return the matching url patterns.
|
E |
map(java.lang.String uri)
Finds the best match for the uri.
|
E |
map(java.lang.String uri,
java.util.ArrayList<java.lang.String> vars) |
E |
map(java.lang.String uri,
java.util.ArrayList<java.lang.String> vars,
boolean isWelcome)
Finds the best match for the uri.
|
static java.lang.String |
urlPatternToRegexpPattern(java.lang.String pattern) |
public UrlMap()
public UrlMap(boolean bestShort)
bestShort
- if true, use the shortest matchpublic void addMap(java.lang.String pattern, E value, boolean isIgnore) throws java.util.regex.PatternSyntaxException
java.util.regex.PatternSyntaxException
public void addMap(java.lang.String pattern, E value) throws java.util.regex.PatternSyntaxException
java.util.regex.PatternSyntaxException
public void addMap(java.lang.String pattern, E value, boolean isIgnore, boolean ifAbsent) throws java.util.regex.PatternSyntaxException
java.util.regex.PatternSyntaxException
public void addMap(java.lang.String pattern, java.lang.String flags, E value, boolean isIgnore, boolean ifAbsent) throws java.util.regex.PatternSyntaxException
pattern
- servlet2.2 url-patternvalue
- object stored as the valuejava.util.regex.PatternSyntaxException
public static java.lang.String urlPatternToRegexpPattern(java.lang.String pattern)
public void addStrictMap(java.lang.String pattern, java.lang.String flags, E value) throws java.util.regex.PatternSyntaxException, ServletException
pattern
- servlet2.2 url-patternvalue
- object stored as the valuejava.util.regex.PatternSyntaxException
ServletException
public void addRegexp(java.lang.String regexp, java.lang.String flags, E value) throws java.util.regex.PatternSyntaxException
java.util.regex.PatternSyntaxException
public void addRegexp(java.lang.String regexp, E value) throws java.util.regex.PatternSyntaxException
java.util.regex.PatternSyntaxException
public void addRegexpIfAbsent(java.lang.String regexp, E value) throws java.util.regex.PatternSyntaxException
java.util.regex.PatternSyntaxException
public void addRegexp(int prefixLength, java.lang.String regexp, java.lang.String flags, E value, boolean isShort, boolean isIgnore, boolean ifAbsent) throws java.util.regex.PatternSyntaxException
prefixLength
- the length of the pattern's mandatory prefixregexp
- the regexp pattern to addflags
- regexp flags, like "i" for case insensitivevalue
- the value for matching the patternisShort
- if true, this regexp expects to be shorter than othersjava.util.regex.PatternSyntaxException
public void addRegexp(int prefixLength, java.lang.String pattern, java.lang.String regexp, java.lang.String flags, E value, boolean isShort, boolean isIgnore, boolean ifAbsent, boolean isSimple) throws java.util.regex.PatternSyntaxException
prefixLength
- the length of the pattern's mandatory prefixpattern
- the regexp pattern to addregexp
- the regexp pattern to addflags
- regexp flags, like "i" for case insensitivevalue
- the value for matching the patternisShort
- if true, this regexp expects to be shorter than othersjava.util.regex.PatternSyntaxException
public E map(java.lang.String uri)
uri
- uri to matchpublic E map(java.lang.String uri, java.util.ArrayList<java.lang.String> vars)
public E map(java.lang.String uri, java.util.ArrayList<java.lang.String> vars, boolean isWelcome)
uri
- uri to matchvars
- a list of the regexp variables.public java.util.ArrayList<java.lang.String> getURLPatterns()