|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Dictionary | +--com.mortbay.HTTP.PathMap
URI Path map to object
Implements a best match of paths to objects
Notes
Paths ending with '$' must match the path absolutely,
Paths ending with '/' must match an exact path element,
Paths ending with '%' match either an absolute path or exact path element
Paths ending with '|' match either an absolute path or trailing '/'
Paths may include a * to separate prefix and suffix matches. Suffix
matches have precedence.
All other paths only need to be a prefix to match.
Path Prefix | Match Examples | Miss Examples |
---|---|---|
/aaa/bbb |
/aaa/bbb /aaa/bbb/ /aaa/bbb/ccc /aaa/bbbbbb |
/aaa /aaa/ccc |
/aaa/bbb% |
/aaa/bbb /aaa/bbb/ /aaa/bbb/ccc |
/aaa /aaa/ccc /aaa/bbbbbb |
/aaa/bbb/ |
/aaa/bbb/ /aaa/bbb/ccc |
/aaa /aaa/bbb /aaa/bbbbbb /aaa/ccc |
/aaa/bbb| |
/aaa/bbb /aaa/bbb/ |
/aaa /aaa/ccc /aaa/bbb/ccc /aaa/bbbbbb |
/aaa/bbb$ |
/aaa/bbb |
/aaa /aaa/ccc /aaa/bbb/ /aaa/bbb/ccc /aaa/bbbbbb |
*.xxx |
.xxx xxx.xxx |
.xxxx xxxx.xxxx .xx xx.xx |
/yyy/*.zzz |
/yyy/.zzz /yyy/xxx.zzz |
.zzz /aaa/xxx.zzz /yyy/xxx.zzzz |
Constructor Summary | |
PathMap()
Construct empty PathMap |
|
PathMap(java.util.Dictionary d)
Construct from dictionary PathMap |
Method Summary | |
void |
add(java.util.Dictionary d)
Add contents of dictionary to PathMap |
void |
clear()
|
java.util.Enumeration |
elements()
|
java.lang.Object |
get(java.lang.Object pathSpec)
Get object by path specification |
java.lang.Object |
getLongestMatch(java.lang.String path)
Deprecated. use match |
boolean |
isEmpty()
|
java.util.Enumeration |
keys()
|
java.lang.String |
longestMatch(java.lang.String path)
Deprecated. use matchSpec |
java.lang.Object |
match(java.lang.String path)
Get the object that is mapped by the longest path specification that matches the path |
static java.lang.String |
match(java.lang.String pathSpec,
java.lang.String path)
Return the portion of a path that matches a path spec (with %$|/ etc.) |
java.lang.String |
matchSpec(java.lang.String path)
Get the pathSpec that is mapped by the longest path specification that matches the path |
static java.lang.String |
pathInfo(java.lang.String pathSpec,
java.lang.String path)
Return the portion of a path that is after a path spec (with %$|/ etc.) |
java.lang.Object |
put(java.lang.Object pathSpec,
java.lang.Object object)
Add a single path match to the PathMap |
java.lang.Object |
put(java.lang.String pathSpec,
java.lang.Object object)
Add a single path match to the PathMap |
java.lang.Object |
remove(java.lang.Object pathSpec)
|
java.lang.Object |
remove(java.lang.String pathSpec)
|
int |
size()
|
java.lang.String |
toString()
|
static java.lang.String |
translate(java.lang.String oldPath,
java.lang.String pathSpec,
java.lang.String newPath)
Return a translated address. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public PathMap()
public PathMap(java.util.Dictionary d)
Method Detail |
public void add(java.util.Dictionary d)
public java.lang.Object put(java.lang.String pathSpec, java.lang.Object object)
pathSpec
- The path specification.object
- The object the path maps topublic java.lang.Object put(java.lang.Object pathSpec, java.lang.Object object)
pathSpec
- The path specification.object
- The object the path maps topublic java.lang.Object match(java.lang.String path)
public java.lang.String matchSpec(java.lang.String path)
public java.util.Enumeration elements()
public java.lang.Object get(java.lang.Object pathSpec)
public java.lang.String longestMatch(java.lang.String path)
public java.lang.Object getLongestMatch(java.lang.String path)
public boolean isEmpty()
public java.util.Enumeration keys()
public java.lang.Object remove(java.lang.Object pathSpec)
public java.lang.Object remove(java.lang.String pathSpec)
public int size()
public void clear()
public static java.lang.String pathInfo(java.lang.String pathSpec, java.lang.String path) throws java.net.MalformedURLException
public static java.lang.String match(java.lang.String pathSpec, java.lang.String path)
public java.lang.String toString()
public static java.lang.String translate(java.lang.String oldPath, java.lang.String pathSpec, java.lang.String newPath)
oldPath
- A URL path to be translatedpathSpec
- The PathMap path string that matched (may include
special %|$ etc characters).newPath
- The string to replace the path with.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |