org.apache.http.protocol
Class UriHttpRequestHandlerMapper

java.lang.Object
  extended by org.apache.http.protocol.UriHttpRequestHandlerMapper
All Implemented Interfaces:
HttpRequestHandlerMapper

@ThreadSafe
public class UriHttpRequestHandlerMapper
extends Object
implements HttpRequestHandlerMapper

Maintains a map of HTTP request handlers keyed by a request URI pattern.
Patterns may have three formats:


This class can be used to map an instance of HttpRequestHandler matching a particular request URI. Usually the mapped request handler will be used to process the request with the specified request URI.

Since:
4.3

Constructor Summary
  UriHttpRequestHandlerMapper()
           
protected UriHttpRequestHandlerMapper(UriPatternMatcher<HttpRequestHandler> matcher)
           
 
Method Summary
protected  String getRequestPath(HttpRequest request)
          Extracts request path from the given HttpRequest
 HttpRequestHandler lookup(HttpRequest request)
          Looks up a handler matching the given request URI.
 void register(String pattern, HttpRequestHandler handler)
          Registers the given HttpRequestHandler as a handler for URIs matching the given pattern.
 void unregister(String pattern)
          Removes registered handler, 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

UriHttpRequestHandlerMapper

protected UriHttpRequestHandlerMapper(UriPatternMatcher<HttpRequestHandler> matcher)

UriHttpRequestHandlerMapper

public UriHttpRequestHandlerMapper()
Method Detail

register

public void register(String pattern,
                     HttpRequestHandler handler)
Registers the given HttpRequestHandler as a handler for URIs matching the given pattern.

Parameters:
pattern - the pattern to register the handler for.
handler - the handler.

unregister

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

Parameters:
pattern - the pattern to unregister the handler for.

getRequestPath

protected String getRequestPath(HttpRequest request)
Extracts request path from the given HttpRequest


lookup

public HttpRequestHandler lookup(HttpRequest request)
Looks up a handler matching the given request URI.

Specified by:
lookup in interface HttpRequestHandlerMapper
Parameters:
request - the request
Returns:
handler or null if no match is found.


Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.