Package org.eclipse.jetty.http
Class PathMap<O>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,O>
-
- org.eclipse.jetty.http.PathMap<O>
-
- Type Parameters:
O
- the Map.Entry value type
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,O>
@Deprecated public class PathMap<O> extends HashMap<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.-
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>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clear()
Deprecated.boolean
containsMatch(String path)
Deprecated.Return whether the path matches any entries in the PathMap, excluding the default entryPathMap.MappedEntry<O>
getMatch(String path)
Deprecated.Get the entry mapped by the best specification.List<? extends Map.Entry<String,O>>
getMatches(String path)
Deprecated.Get all entries matched by the path.O
match(String path)
Deprecated.Get object matched by the path.static boolean
match(String pathSpec, String path)
Deprecated.static boolean
match(String pathSpec, String path, boolean noDefault)
Deprecated.static String
pathInfo(String pathSpec, String path)
Deprecated.Return the portion of a path that is after a path spec.static String
pathMatch(String pathSpec, String path)
Deprecated.Return the portion of a path that matches a path spec.O
put(String pathSpec, O object)
Deprecated.Add a single path match to the PathMap.static String
relativePath(String base, String pathSpec, String path)
Deprecated.Relative path.O
remove(Object pathSpec)
Deprecated.static void
setPathSpecSeparators(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
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
Method Detail
-
setPathSpecSeparators
public static void setPathSpecSeparators(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
-
match
public O match(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(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 List<? extends Map.Entry<String,O>> getMatches(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(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
-
clear
public void clear()
Deprecated.
-
match
public static boolean match(String pathSpec, String path)
Deprecated.- Parameters:
pathSpec
- the path specpath
- the path- Returns:
- true if match.
-
match
public static boolean match(String pathSpec, 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 String pathMatch(String pathSpec, 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 String pathInfo(String pathSpec, 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
-
-