Class PathMap<O>
- Type Parameters:
O- the Map.Entry value type
- All Implemented Interfaces:
Serializable, Cloneable, Map<String,O>
Deprecated.
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. "" - the / path specificationMatching is performed in the following order
- Exact match.
- Longest prefix match.
- Longest suffix match.
- default.
Multiple path specifications can be mapped by providing a list of specifications. By default this class uses characters ":," as path separators, unless configured differently by calling the static method @see PathMap#setPathSpecSeparators(String)
Special characters within paths such as '?� and ';' are not treated specially as it is assumed they would have been either encoded in the original URL or stripped from the path.
This class is not synchronized. If concurrent modifications are possible then it should be synchronized at a higher level.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.static classDeprecated.Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static StringDeprecated.(package private) PathMap.MappedEntry<O> Deprecated.(package private) List<PathMap.MappedEntry<O>> Deprecated.(package private) final Map<String, PathMap.MappedEntry<O>> Deprecated.(package private) booleanDeprecated.(package private) PathMap.MappedEntry<O> Deprecated.(package private) Trie<PathMap.MappedEntry<O>> Deprecated.(package private) Trie<PathMap.MappedEntry<O>> Deprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Deprecated.booleancontainsMatch(String path) Deprecated.Return whether the path matches any entries in the PathMap, excluding the default entryDeprecated.Get the entry mapped by the best specification.getMatches(String path) Deprecated.Get all entries matched by the path.private static booleanisPathWildcardMatch(String pathSpec, String path) Deprecated.Deprecated.Get object matched by the path.static booleanDeprecated.static booleanDeprecated.static StringDeprecated.Return the portion of a path that is after a path spec.static StringDeprecated.Return the portion of a path that matches a path spec.Deprecated.Add a single path match to the PathMap.static StringrelativePath(String base, String pathSpec, String path) Deprecated.Relative path.Deprecated.static voidDeprecated.Set the path spec separator.Methods inherited from class HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, valuesMethods inherited from class AbstractMap
equals, hashCode, toString
-
Field Details
-
__pathSpecSeparators
Deprecated. -
_prefixMap
Trie<PathMap.MappedEntry<O>> _prefixMapDeprecated. -
_suffixMap
Trie<PathMap.MappedEntry<O>> _suffixMapDeprecated. -
_exactMap
Deprecated. -
_defaultSingletonList
List<PathMap.MappedEntry<O>> _defaultSingletonListDeprecated. -
_prefixDefault
PathMap.MappedEntry<O> _prefixDefaultDeprecated. -
_default
PathMap.MappedEntry<O> _defaultDeprecated. -
_nodefault
boolean _nodefaultDeprecated.
-
-
Constructor Details
-
PathMap
public PathMap()Deprecated. -
PathMap
public PathMap(boolean noDefault) Deprecated. -
PathMap
public PathMap(int capacity) Deprecated. -
PathMap
private PathMap(int capacity, boolean noDefault) Deprecated. -
PathMap
-
-
Method Details
-
setPathSpecSeparators
Deprecated.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. By default this class uses ":," characters as path separators.- Parameters:
s- separators
-
put
Deprecated.Add a single path match to the PathMap. -
match
-
getMatch
Deprecated.Get the entry mapped by the best specification.- Parameters:
path- the path.- Returns:
- Map.Entry of the best matched or null.
-
getMatches
-
containsMatch
Deprecated.Return whether the path matches any entries in the PathMap, excluding the default entry- Parameters:
path- Path to match- Returns:
- Whether the PathMap contains any entries that match this
-
remove
-
clear
-
match
-
match
-
isPathWildcardMatch
-
pathMatch
-
pathInfo
-
relativePath
-
PathMappings(this class will be removed in Jetty 10)