Package org.apache.http.protocol
Class UriPatternMatcher<T>
- java.lang.Object
-
- org.apache.http.protocol.UriPatternMatcher<T>
-
- Type Parameters:
T- The type of registered objects.
@Contract(threading=SAFE) public class UriPatternMatcher<T> extends java.lang.Object
Maintains a map of objects keyed by a request URI pattern.
Patterns may have three formats:**<uri><uri>*
This class can be used to resolve an object matching a particular request URI.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description UriPatternMatcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Set<java.util.Map.Entry<java.lang.String,T>>entrySet()Returns aSetview of the mappings contained in this matcher.java.util.Map<java.lang.String,T>getObjects()Deprecated.(4.1) do not useTlookup(java.lang.String path)Looks up an object matching the given request path.protected booleanmatchUriRequestPattern(java.lang.String pattern, java.lang.String path)Tests if the given request path matches the given pattern.voidregister(java.lang.String pattern, T obj)Registers the given object for URIs matching the given pattern.voidsetHandlers(java.util.Map<java.lang.String,T> map)Deprecated.(4.1) do not usevoidsetObjects(java.util.Map<java.lang.String,T> map)Deprecated.(4.1) do not usejava.lang.StringtoString()voidunregister(java.lang.String pattern)Removes registered object, if exists, for the given pattern.
-
-
-
Method Detail
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,T>> entrySet()
Returns aSetview of the mappings contained in this matcher.- Returns:
- a set view of the mappings contained in this matcher.
- Since:
- 4.4.9
- See Also:
Map.entrySet()
-
register
public void register(java.lang.String pattern, T obj)Registers the given object for URIs matching the given pattern.- Parameters:
pattern- the pattern to register the handler for.obj- the object.
-
unregister
public void unregister(java.lang.String pattern)
Removes registered object, if exists, for the given pattern.- Parameters:
pattern- the pattern to unregister.
-
setHandlers
@Deprecated public void setHandlers(java.util.Map<java.lang.String,T> map)
Deprecated.(4.1) do not use
-
setObjects
@Deprecated public void setObjects(java.util.Map<java.lang.String,T> map)
Deprecated.(4.1) do not use
-
getObjects
@Deprecated public java.util.Map<java.lang.String,T> getObjects()
Deprecated.(4.1) do not use
-
lookup
public T lookup(java.lang.String path)
Looks up an object matching the given request path.- Parameters:
path- the request path- Returns:
- object or
nullif no match is found.
-
matchUriRequestPattern
protected boolean matchUriRequestPattern(java.lang.String pattern, java.lang.String path)Tests if the given request path matches the given pattern.- Parameters:
pattern- the patternpath- the request path- Returns:
trueif the request URI matches the pattern,falseotherwise.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-