public class PathMap extends HashMap implements Externalizable
/foo/bar - an exact path specification. /foo/* - a prefix path specification (must end '/*'). *.ext - a suffix path specification. / - the default path specification.Matching is performed in the following order
Note that this is a very different mapping to that provided by PathMap in Jetty2.
This class is not synchronized for get's. If concurrent modifications are possible then it should be synchronized at a higher level.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
PathMap()
Construct empty PathMap.
|
PathMap(boolean nodefault)
Construct empty PathMap.
|
PathMap(int capacity)
Construct empty PathMap.
|
PathMap(Map m)
Construct from dictionary PathMap.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Map.Entry |
getMatch(String path)
Get the entry mapped by the best specification.
|
List |
getMatches(String path)
Get all entries matched by the path.
|
Object |
match(String path)
Get object matched by the path.
|
static boolean |
match(String pathSpec,
String path) |
static boolean |
match(String pathSpec,
String path,
boolean noDefault) |
static String |
pathInfo(String pathSpec,
String path)
Return the portion of a path that is after a path spec.
|
static String |
pathMatch(String pathSpec,
String path)
Return the portion of a path that matches a path spec.
|
Object |
put(Object pathSpec,
Object object)
Add a single path match to the PathMap.
|
void |
readExternal(ObjectInput in) |
static String |
relativePath(String base,
String pathSpec,
String path)
Relative path.
|
Object |
remove(Object pathSpec) |
static void |
setPathSpecSeparators(String s)
Set the path spec separator.
|
void |
writeExternal(ObjectOutput out) |
clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, putAll, size, values
equals, hashCode, toString
public PathMap()
public PathMap(boolean nodefault)
public PathMap(int capacity)
public PathMap(Map m)
public static void setPathSpecSeparators(String s)
s
- separatorspublic void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public Object match(String path)
path
- the path.public Map.Entry getMatch(String path)
path
- the path.public List getMatches(String path)
path
- Path to matchpublic static boolean match(String pathSpec, String path) throws IllegalArgumentException
IllegalArgumentException
public static boolean match(String pathSpec, String path, boolean noDefault) throws IllegalArgumentException
IllegalArgumentException
public static String pathMatch(String pathSpec, String path)
public static String pathInfo(String pathSpec, String path)
Copyright © 2013. All Rights Reserved.