org.apache.hc.core5.http.protocol

## Class RequestHandlerRegistry<T>

- java.lang.Object
- - org.apache.hc.core5.http.protocol.RequestHandlerRegistry<T>

- Type Parameters:
    `T` - request handler type.
  All Implemented Interfaces:
    HttpRequestMapper<T>

      @Contract(threading=SAFE_CONDITIONAL)
      public class RequestHandlerRegistry<T>
      extends Object
      implements HttpRequestMapper<T>

  Generic registry of request handlers that can be resolved by properties of request messages.
  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RequestHandlerRegistry()`
    `RequestHandlerRegistry(String canonicalHostName, Supplier<LookupRegistry<T>> registrySupplier)`
    `RequestHandlerRegistry(String canonicalHostName, UriPatternType patternType)`
    `RequestHandlerRegistry(UriPatternType patternType)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `register(String hostname, String uriPattern, T object)`
    `T` | `resolve(HttpRequest request, HttpContext context)` Resolves a handler matching the given request.

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

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

- - ### Constructor Detail

    - #### RequestHandlerRegistry

          public RequestHandlerRegistry(String canonicalHostName,
                                Supplier<LookupRegistry<T>> registrySupplier)

    - #### RequestHandlerRegistry

          public RequestHandlerRegistry(String canonicalHostName,
                                UriPatternType patternType)

    - #### RequestHandlerRegistry

          public RequestHandlerRegistry(UriPatternType patternType)

    - #### RequestHandlerRegistry

          public RequestHandlerRegistry()

  - ### Method Detail

    - #### resolve

          public T resolve(HttpRequest request,
                  HttpContext context)
                    throws MisdirectedRequestException

      Description copied from interface: `HttpRequestMapper`
      Resolves a handler matching the given request.
      Specified by:
        `resolve` in interface `HttpRequestMapper<T>`
      Parameters:
        `request` - the request to map to a handler
      Returns:
        HTTP request handler or `null` if no match is found.
      Throws:
        `MisdirectedRequestException`

    - #### register

          public void register(String hostname,
                      String uriPattern,
                      T object)

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