|
|||||||||
| Home >> All >> org >> mortbay >> [ http overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.mortbay.http
Class PathMap

java.lang.Objectjava.util.AbstractMap
java.util.HashMap
org.mortbay.http.PathMap
- All Implemented Interfaces:
- java.lang.Cloneable, java.io.Externalizable, java.util.Map, java.io.Serializable
- public class PathMap
- extends java.util.HashMap
- implements java.io.Externalizable
- extends java.util.HashMap
URI path map to Object. This mapping implements the path specification recommended in the 2.2 Servlet API. Path specifications can be of the following forms:
/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.
- Version:
- $Id: PathMap.java,v 1.19 2003/11/16 11:30:52 gregwilkins Exp $
| Nested Class Summary | |
private static class |
PathMap.Entry
|
| Nested classes inherited from class java.util.HashMap |
|
| Nested classes inherited from class java.util.AbstractMap |
|
| Field Summary | |
static boolean |
__oldDefaultPath
|
private static java.lang.String |
__pathSpecSeparators
|
(package private) java.util.Map.Entry |
_default
|
(package private) java.util.List |
_defaultSingletonList
|
(package private) java.util.Set |
_entrySet
|
(package private) org.mortbay.util.StringMap |
_exactMap
|
(package private) java.util.Map.Entry |
_prefixDefault
|
(package private) org.mortbay.util.StringMap |
_prefixMap
|
(package private) org.mortbay.util.StringMap |
_suffixMap
|
private static org.apache.commons.logging.Log |
log
|
| Fields inherited from class java.util.HashMap |
|
| Fields inherited from class java.util.AbstractMap |
|
| Constructor Summary | |
PathMap()
Construct empty PathMap. |
|
PathMap(int capacity)
Construct empty PathMap. |
|
PathMap(java.util.Map m)
Construct from dictionary PathMap. |
|
| Method Summary | |
void |
clear()
Clears the Map so it has no keys. |
java.util.Map.Entry |
getMatch(java.lang.String path)
Get the entry mapped by the best specification. |
java.util.List |
getMatches(java.lang.String path)
Get all entries matched by the path. |
java.lang.Object |
match(java.lang.String path)
Get object matched by the path. |
static boolean |
match(java.lang.String pathSpec,
java.lang.String 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. |
static java.lang.String |
pathMatch(java.lang.String pathSpec,
java.lang.String path)
Return the portion of a path that matches a path spec. |
java.lang.Object |
put(java.lang.Object pathSpec,
java.lang.Object object)
Add a single path match to the PathMap. |
void |
readExternal(java.io.ObjectInput in)
This method restores an object's state by reading in the instance data for the object from the passed in stream. |
static java.lang.String |
relativePath(java.lang.String base,
java.lang.String pathSpec,
java.lang.String path)
Relative path. |
java.lang.Object |
remove(java.lang.Object pathSpec)
Removes from the HashMap and returns the value which is mapped by the supplied key. |
static void |
setPathSpecSeparators(java.lang.String s)
Set the path spec separator. |
void |
writeExternal(java.io.ObjectOutput out)
This method is responsible for writing the instance data of an object to the passed in stream. |
| Methods inherited from class java.util.HashMap |
clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, putAll, size, values |
| Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode |
| Field Detail |
log
private static org.apache.commons.logging.Log log
__pathSpecSeparators
private static java.lang.String __pathSpecSeparators
__oldDefaultPath
public static boolean __oldDefaultPath
_prefixMap
org.mortbay.util.StringMap _prefixMap
_suffixMap
org.mortbay.util.StringMap _suffixMap
_exactMap
org.mortbay.util.StringMap _exactMap
_defaultSingletonList
java.util.List _defaultSingletonList
_prefixDefault
java.util.Map.Entry _prefixDefault
_default
java.util.Map.Entry _default
_entrySet
java.util.Set _entrySet
| Constructor Detail |
PathMap
public PathMap()
- Construct empty PathMap.
PathMap
public PathMap(int capacity)
- Construct empty PathMap.
PathMap
public PathMap(java.util.Map m)
- Construct from dictionary PathMap.
| Method Detail |
setPathSpecSeparators
public static void setPathSpecSeparators(java.lang.String s)
- Set the path spec separator.
Multiple path specification may be included in a single string
if they are separated by the characters set in this string.
The default value is ":," or whatever has been set by the
system property org.mortbay.http.PathMap.separators
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Description copied from interface:
java.io.Externalizable - This method is responsible for writing the instance data of an object
to the passed in stream. Note that this stream is not a subclass of
OutputStream, but rather is a class that implements theObjectOutputinterface. That interface provides a number of methods for writing Java data values to a stream.Not that the implementation of this method must be coordinated with the implementation of
readExternal.- Specified by:
writeExternalin interfacejava.io.Externalizable
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Description copied from interface:
java.io.Externalizable - This method restores an object's state by reading in the instance data
for the object from the passed in stream. Note that this stream is not
a subclass of
InputStream, but rather is a class that implements theObjectInputinterface. That interface provides a mechanism for reading in Java data types from a stream.Note that this method must be compatible with
writeExternal. It must read back the exact same types that were written by that method in the exact order they were written.If this method needs to read back an object instance, then the class for that object must be found and loaded. If that operation fails, then this method throws a
ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable
put
public java.lang.Object put(java.lang.Object pathSpec, java.lang.Object object)
- Add a single path match to the PathMap.
- Specified by:
putin interfacejava.util.Map
match
public java.lang.Object match(java.lang.String path)
- Get object matched by the path.
getMatch
public java.util.Map.Entry getMatch(java.lang.String path)
- Get the entry mapped by the best specification.
getMatches
public java.util.List getMatches(java.lang.String path)
- Get all entries matched by the path.
Best match first.
remove
public java.lang.Object remove(java.lang.Object pathSpec)
- Description copied from class:
java.util.HashMap - Removes from the HashMap and returns the value which is mapped by the
supplied key. If the key maps to nothing, then the HashMap remains
unchanged, and
nullis returned. NOTE: Since the value could also be null, you must use containsKey to see if you are actually removing a mapping.- Specified by:
removein interfacejava.util.Map
clear
public void clear()
- Description copied from class:
java.util.HashMap - Clears the Map so it has no keys. This is O(1).
- Specified by:
clearin interfacejava.util.Map
match
public static boolean match(java.lang.String pathSpec, java.lang.String path) throws java.lang.IllegalArgumentException
pathMatch
public static java.lang.String pathMatch(java.lang.String pathSpec, java.lang.String path)
- Return the portion of a path that matches a path spec.
pathInfo
public 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.
relativePath
public static java.lang.String relativePath(java.lang.String base, java.lang.String pathSpec, java.lang.String path)
- Relative path.
|
|||||||||
| Home >> All >> org >> mortbay >> [ http overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC