Top Description Fields Constructors Methods
org.apache.hc.core5.http.protocol

public Class UriPatternMatcher<T>

extends Object
implements LookupRegistry<T>
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.protocol.LookupRegistry
Annotations
@Contract
threading:SAFE
Type Parameters
<T>
The type of registered objects.
Imports
java.util.HashSet, .LinkedHashMap, .Map, .Map.Entry, .Set, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.util.Args

Maintains a map of objects keyed by a request URI pattern.

Patterns may have three formats:

This class can be used to resolve an object matching a particular request URI.

Since
4.0

Field Summary

Modifier and TypeField and Description
private final Map<String, T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized Set<Map.Entry<String, T>>

Returns:

a set view of the mappings contained in this matcher.
entrySet
()

Returns a Set view of the mappings contained in this matcher.

public synchronized T

Returns:

object or null if no match is found.
lookup
(final String
the request path
path
)

Implements org.apache.hc.core5.http.protocol.LookupRegistry.lookup.

Looks up an object matching the given request path.
protected boolean

Returns:

true if the request URI matches the pattern, false otherwise.
matchUriRequestPattern
(final String
the pattern
pattern
,
final String
the request path
path
)

Tests if the given request path matches the given pattern.

public synchronized void
register(final String
the pattern to register the handler for.
pattern
,
final T
the object.
obj
)

Implements org.apache.hc.core5.http.protocol.LookupRegistry.register.

Registers the given object for URIs matching the given pattern.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public synchronized void
unregister(final String
the pattern to unregister.
pattern
)

Implements org.apache.hc.core5.http.protocol.LookupRegistry.unregister.

Removes registered object, if exists, for the given pattern.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

mapback to summary
private final Map<String, T> map

Constructor Detail

UriPatternMatcherback to summary
public UriPatternMatcher()

Method Detail

entrySetback to summary
public synchronized Set<Map.Entry<String, T>> entrySet()

Returns a Set view of the mappings contained in this matcher.

Returns:Set<Map.Entry<String, T>>

a set view of the mappings contained in this matcher.

Since
4.4.9
See Also
Map#entrySet()
lookupback to summary
public synchronized T lookup(final String path)

Implements org.apache.hc.core5.http.protocol.LookupRegistry.lookup.

Looks up an object matching the given request path.

Parameters
path:String

the request path

Returns:T

object or null if no match is found.

Annotations
@Override
matchUriRequestPatternback to summary
protected boolean matchUriRequestPattern(final String pattern, final String path)

Tests if the given request path matches the given pattern.

Parameters
pattern:String

the pattern

path:String

the request path

Returns:boolean

true if the request URI matches the pattern, false otherwise.

registerback to summary
public synchronized void register(final String pattern, final T obj)

Implements org.apache.hc.core5.http.protocol.LookupRegistry.register.

Registers the given object for URIs matching the given pattern.

Parameters
pattern:String

the pattern to register the handler for.

obj:T

the object.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
unregisterback to summary
public synchronized void unregister(final String pattern)

Implements org.apache.hc.core5.http.protocol.LookupRegistry.unregister.

Removes registered object, if exists, for the given pattern.

Parameters
pattern:String

the pattern to unregister.

Annotations
@Override