org.apache.http.protocol

## Class UriPatternMatcher<T>

- java.lang.Object
- - org.apache.http.protocol.UriPatternMatcher<T>

    @ThreadSafe
    public class UriPatternMatcher<T>
    extends 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 and Description
`UriPatternMatcher()`

### Method Summary

Methods
`Map<String,T>` `getObjects()` Deprecated. (4.1) do not use
`T` `lookup(String path)` Looks up an object matching the given request path.
`protected boolean` `matchUriRequestPattern(String pattern, String path)` Tests if the given request path matches the given pattern.
`void` `register(String pattern, T obj)` Registers the given object for URIs matching the given pattern.
`void` `setHandlers(Map<String,T> map)` Deprecated. (4.1) do not use
`void` `setObjects(Map<String,T> map)` Deprecated. (4.1) do not use
`String` `toString()`
`void` `unregister(String pattern)` Removes registered object, if exists, for the given pattern.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### UriPatternMatcher

    public UriPatternMatcher()

### Method Detail

#### register

    public void register(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(String pattern)

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

Parameters:
  `pattern` - the pattern to unregister.

#### setHandlers

    @Deprecated
    public void setHandlers(Map<String,T> map)

Deprecated. (4.1) do not use

#### setObjects

    @Deprecated
    public void setObjects(Map<String,T> map)

Deprecated. (4.1) do not use

#### getObjects

    @Deprecated
    public Map<String,T> getObjects()

Deprecated. (4.1) do not use

#### lookup

    public T lookup(String path)

Looks up an object matching the given request path.

Parameters:
  `path` - the request path
Returns:
  object or `null` if no match is found.

#### matchUriRequestPattern

    protected boolean matchUriRequestPattern(String pattern,
                                 String path)

Tests if the given request path matches the given pattern.

Parameters:
  `pattern` - the pattern
  `path` - the request path
Returns:
  `true` if the request URI matches the pattern, `false` otherwise.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`