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

public Class UriPatternMatcher<T>

extends Object
Class Inheritance
Annotations
@Contract
threading:SAFE
Type Parameters
<T>
The type of registered objects.
Imports
java.util.HashSet, .LinkedHashMap, .Map, .Map.Entry, .Set, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.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 Map<String, T>
getObjects()

Deprecated (4.1) do not use
public synchronized T

Returns:

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

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
)

Registers the given object for URIs matching the given pattern.

public synchronized void
setHandlers(final Map<String, T> map)

Deprecated (4.1) do not use
public synchronized void
setObjects(final Map<String, T> map)

Deprecated (4.1) do not use
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
)

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()
getObjectsback to summary
public synchronized Map<String, T> getObjects()

Deprecated

(4.1) do not use

Annotations
@Deprecated
lookupback to summary
public synchronized T lookup(final String path)

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.

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)

Registers the given object for URIs matching the given pattern.

Parameters
pattern:String

the pattern to register the handler for.

obj:T

the object.

setHandlersback to summary
public synchronized void setHandlers(final Map<String, T> map)

Deprecated

(4.1) do not use

Annotations
@Deprecated
setObjectsback to summary
public synchronized void setObjects(final Map<String, T> map)

Deprecated

(4.1) do not use

Annotations
@Deprecated
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)

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

Parameters
pattern:String

the pattern to unregister.