public class

UriPatternMatcher

extends Object
java.lang.Object
   ↳ org.apache.http.protocol.UriPatternMatcher

Class Overview

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.

Summary

Public Constructors
UriPatternMatcher()
Public Methods
synchronized Object lookup(String requestURI)
Looks up an object matching the given request URI.
synchronized void register(String pattern, Object obj)
Registers the given object for URIs matching the given pattern.
synchronized void setHandlers(Map map)
This method is deprecated. use setObjects(Map)
synchronized void setObjects(Map map)
Sets objects from the given map.
synchronized void unregister(String pattern)
Removes registered object, if exists, for the given pattern.
Protected Methods
boolean matchUriRequestPattern(String pattern, String requestUri)
Tests if the given request URI matches the given pattern.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public UriPatternMatcher ()

Public Methods

public synchronized Object lookup (String requestURI)

Looks up an object matching the given request URI.

Parameters
requestURI the request URI
Returns
  • object or null if no match is found.

public synchronized void register (String pattern, Object obj)

Registers the given object for URIs matching the given pattern.

Parameters
pattern the pattern to register the handler for.
obj the object.

public synchronized void setHandlers (Map map)

This method is deprecated.
use setObjects(Map)

public synchronized void setObjects (Map map)

Sets objects from the given map.

Parameters
map the map containing objects keyed by their URI patterns.

public synchronized void unregister (String pattern)

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

Parameters
pattern the pattern to unregister.

Protected Methods

protected boolean matchUriRequestPattern (String pattern, String requestUri)

Tests if the given request URI matches the given pattern.

Parameters
pattern the pattern
requestUri the request URI
Returns
  • true if the request URI matches the pattern, false otherwise.