Class UriRegexMatcher<T>
java.lang.Object
org.apache.hc.core5.http.protocol.UriRegexMatcher<T>
- Type Parameters:
T
- The type of registered objects.
- All Implemented Interfaces:
LookupRegistry<T>
@Contract(threading=SAFE)
public class UriRegexMatcher<T>
extends Object
implements LookupRegistry<T>
Maintains a map of objects keyed by a request URI regular expression.
The insertion order is in maintained in that map such that the lookup tests each regex until there is a match. This class can be used to resolve an object matching a particular request URI.
- Since:
- 5.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLooks up an object matching the given request path.void
Registers the given object for URIs matching the given regex.toString()
void
unregister
(String regex) Removes registered object, if exists, for the given regex.
-
Field Details
-
objectMap
-
patternMap
-
-
Constructor Details
-
UriRegexMatcher
public UriRegexMatcher()
-
-
Method Details
-
register
Registers the given object for URIs matching the given regex.- Specified by:
register
in interfaceLookupRegistry<T>
- Parameters:
regex
- the regex to register the handler for.obj
- the object.
-
unregister
Removes registered object, if exists, for the given regex.- Specified by:
unregister
in interfaceLookupRegistry<T>
- Parameters:
regex
- the regex to unregister.
-
lookup
Looks up an object matching the given request path.- Specified by:
lookup
in interfaceLookupRegistry<T>
- Parameters:
path
- the request path- Returns:
- object or
null
if no match is found.
-
toString
-