Package org.eclipse.jetty.http
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 class
Deprecated.static class
Deprecated.Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static String
Deprecated.(package private) PathMap.MappedEntry<O>
Deprecated.(package private) List<PathMap.MappedEntry<O>>
Deprecated.(package private) final Map<String,
PathMap.MappedEntry<O>> Deprecated.(package private) boolean
Deprecated.(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 TypeMethodDescriptionvoid
clear()
Deprecated.boolean
containsMatch
(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 boolean
isPathWildcardMatch
(String pathSpec, String path) Deprecated.Deprecated.Get object matched by the path.static boolean
Deprecated.static boolean
Deprecated.static String
Deprecated.Return the portion of a path that is after a path spec.static String
Deprecated.Return the portion of a path that matches a path spec.Deprecated.Add a single path match to the PathMap.static String
relativePath
(String base, String pathSpec, String path) Deprecated.Relative path.Deprecated.static void
Deprecated.Set the path spec separator.Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, values
Methods inherited from class java.util.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
Deprecated.Construct from dictionary PathMap.- Parameters:
dictMap
- the map representing the dictionary to build this PathMap from
-
-
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
Deprecated.Get object matched by the path.- Parameters:
path
- the path.- Returns:
- Best matched object or null.
-
getMatch
Deprecated.Get the entry mapped by the best specification.- Parameters:
path
- the path.- Returns:
- Map.Entry of the best matched or null.
-
getMatches
Deprecated.Get all entries matched by the path. Best match first.- Parameters:
path
- Path to match- Returns:
- List of Map.Entry instances key=pathSpec
-
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
Deprecated. -
clear
public void clear()Deprecated. -
match
Deprecated.- Parameters:
pathSpec
- the path specpath
- the path- Returns:
- true if match.
-
match
Deprecated.- Parameters:
pathSpec
- the path specpath
- the pathnoDefault
- true to not handle the default path "/" special, false to allow matcher rules to run- Returns:
- true if match.
-
isPathWildcardMatch
Deprecated. -
pathMatch
Deprecated.Return the portion of a path that matches a path spec.- Parameters:
pathSpec
- the path specpath
- the path- Returns:
- null if no match at all.
-
pathInfo
Deprecated.Return the portion of a path that is after a path spec.- Parameters:
pathSpec
- the path specpath
- the path- Returns:
- The path info string
-
relativePath
Deprecated.Relative path.- Parameters:
base
- The base the path is relative to.pathSpec
- The spec of the path segment to ignore.path
- the additional path- Returns:
- base plus path with pathspec removed
-
PathMappings
(this class will be removed in Jetty 10)