org.apache.http.protocol
Class UriPatternMatcher

java.lang.Object
  extended by org.apache.http.protocol.UriPatternMatcher

public class UriPatternMatcher
extends Object

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

Constructor Summary
UriPatternMatcher()
           
 
Method Summary
 Object lookup(String requestURI)
          Looks up an object matching the given request URI.
protected  boolean matchUriRequestPattern(String pattern, String requestUri)
          Tests if the given request URI matches the given pattern.
 void register(String pattern, Object obj)
          Registers the given object for URIs matching the given pattern.
 void setHandlers(Map map)
          Deprecated. use setObjects(Map)
 void setObjects(Map map)
          Sets objects from the given map.
 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, toString, wait, wait, wait
 

Constructor Detail

UriPatternMatcher

public UriPatternMatcher()
Method Detail

register

public 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.

unregister

public void unregister(String pattern)
Removes registered object, if exists, for the given pattern.

Parameters:
pattern - the pattern to unregister.

setHandlers

public void setHandlers(Map map)
Deprecated. use setObjects(Map)


setObjects

public void setObjects(Map map)
Sets objects from the given map.

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

lookup

public 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.

matchUriRequestPattern

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.


Copyright © 2005-2011 The Apache Software Foundation. All Rights Reserved.