|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.cms.util.SimpleUrlPattern
public final class SimpleUrlPattern
An implementation of URLPattern which matches strings using simple *
or ?
wildcards.
TODO rewrite this class using ant-style path comparison and avoiding regexp. See
org.springframework.util.AntPathMatcher in spring 1.2 for a nice implementation.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface info.magnolia.cms.util.UrlPattern |
---|
UrlPattern.MatchAllPattern |
Field Summary | |
---|---|
static String |
MULTIPLE_CHAR_PATTERN
Regexp pattern used for the simple keyword * . |
static String |
SINGLE_CHAR_PATTERN
Regexp pattern used for the simple keyword ? . |
static String |
URL_CHAR_PATTERN
Any char, newline included. |
Fields inherited from interface info.magnolia.cms.util.UrlPattern |
---|
MATCH_ALL |
Constructor Summary | |
---|---|
SimpleUrlPattern()
Default constructor used by ContentToBean. |
|
SimpleUrlPattern(String string)
Compile a regexp pattern handling * and ? chars. |
Method Summary | |
---|---|
static String |
getEncodedString(String str)
Replace all "*" with RegexWildcardPattern.MULTIPLE_CHAR_PATTERN . |
int |
getLength()
Returns the pattern length. |
String |
getPatternString()
Returns the pattern string. |
boolean |
match(String str)
Does the patter match the given url? |
void |
setPatternString(String patternString)
Mainly used by ContentToBean. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String URL_CHAR_PATTERN
public static final String MULTIPLE_CHAR_PATTERN
*
. Matches 0 or more characters.
public static final String SINGLE_CHAR_PATTERN
?
. Matches 0 or 1 character.
Constructor Detail |
---|
public SimpleUrlPattern()
public SimpleUrlPattern(String string)
*
and ?
chars.
string
- input stringMethod Detail |
---|
public static String getEncodedString(String str)
RegexWildcardPattern.MULTIPLE_CHAR_PATTERN
.
str
- input string
*
and ?
are replaced with a regexp
pattern.public boolean match(String str)
UrlPattern
match
in interface UrlPattern
str
- url to match
true
if the given URL matches the patternUrlPattern.match(java.lang.String)
public int getLength()
UrlPattern
getLength
in interface UrlPattern
UrlPattern.getLength()
public String getPatternString()
UrlPattern
getPatternString
in interface UrlPattern
info.magnolia.cms.util.UrlPattern#getString()
public void setPatternString(String patternString)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |