Package org.eclipse.jetty.http
Class PathMap<O>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<java.lang.String,O>
-
- org.eclipse.jetty.http.PathMap<O>
-
- Type Parameters:
O
- the Map.Entry value type
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<java.lang.String,O>
@Deprecated public class PathMap<O> extends java.util.HashMap<java.lang.String,O>
Deprecated.replaced withPathMappings
(this class will be removed in Jetty 10)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 specification
Matching 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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PathMap.MappedEntry<O>
Deprecated.static class
PathMap.PathSet
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clear()
Deprecated.boolean
containsMatch(java.lang.String path)
Deprecated.Return whether the path matches any entries in the PathMap, excluding the default entryPathMap.MappedEntry<O>
getMatch(java.lang.String path)
Deprecated.Get the entry mapped by the best specification.java.util.List<? extends java.util.Map.Entry<java.lang.String,O>>
getMatches(java.lang.String path)
Deprecated.Get all entries matched by the path.O
match(java.lang.String path)
Deprecated.Get object matched by the path.static boolean
match(java.lang.String pathSpec, java.lang.String path)
Deprecated.static boolean
match(java.lang.String pathSpec, java.lang.String path, boolean noDefault)
Deprecated.static java.lang.String
pathInfo(java.lang.String pathSpec, java.lang.String path)
Deprecated.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)
Deprecated.Return the portion of a path that matches a path spec.O
put(java.lang.String pathSpec, O object)
Deprecated.Add a single path match to the PathMap.static java.lang.String
relativePath(java.lang.String base, java.lang.String pathSpec, java.lang.String path)
Deprecated.Relative path.O
remove(java.lang.Object pathSpec)
Deprecated.static void
setPathSpecSeparators(java.lang.String s)
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
-
-
-
-
Constructor Detail
-
PathMap
public PathMap()
Deprecated.
-
PathMap
public PathMap(boolean noDefault)
Deprecated.
-
PathMap
public PathMap(int capacity)
Deprecated.
-
PathMap
public PathMap(java.util.Map<java.lang.String,? extends O> dictMap)
Deprecated.Construct from dictionary PathMap.- Parameters:
dictMap
- the map representing the dictionary to build this PathMap from
-
-
Method Detail
-
setPathSpecSeparators
public static void setPathSpecSeparators(java.lang.String s)
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
public O put(java.lang.String pathSpec, O object)
Deprecated.Add a single path match to the PathMap.
-
match
public O match(java.lang.String path)
Deprecated.Get object matched by the path.- Parameters:
path
- the path.- Returns:
- Best matched object or null.
-
getMatch
public PathMap.MappedEntry<O> getMatch(java.lang.String path)
Deprecated.Get the entry mapped by the best specification.- Parameters:
path
- the path.- Returns:
- Map.Entry of the best matched or null.
-
getMatches
public java.util.List<? extends java.util.Map.Entry<java.lang.String,O>> getMatches(java.lang.String path)
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
public boolean containsMatch(java.lang.String path)
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
public O remove(java.lang.Object pathSpec)
Deprecated.
-
clear
public void clear()
Deprecated.
-
match
public static boolean match(java.lang.String pathSpec, java.lang.String path)
Deprecated.- Parameters:
pathSpec
- the path specpath
- the path- Returns:
- true if match.
-
match
public static boolean match(java.lang.String pathSpec, java.lang.String path, boolean noDefault)
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.
-
pathMatch
public static java.lang.String pathMatch(java.lang.String pathSpec, java.lang.String path)
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
public static java.lang.String pathInfo(java.lang.String pathSpec, java.lang.String path)
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
public static java.lang.String relativePath(java.lang.String base, java.lang.String pathSpec, java.lang.String path)
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
-
-