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 java.lang.Object implements HttpRequestMapper<T>
Generic registry of request handlers that can be resolved by properties of request messages.- Since:
- 5.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
canonicalHostName
private static java.lang.String
IP_127_0_0_1
private static java.lang.String
LOCALHOST
private LookupRegistry<T>
primary
private Supplier<LookupRegistry<T>>
registrySupplier
private java.util.concurrent.ConcurrentMap<java.lang.String,LookupRegistry<T>>
virtualMap
-
Constructor Summary
Constructors Constructor Description RequestHandlerRegistry()
RequestHandlerRegistry(java.lang.String canonicalHostName, Supplier<LookupRegistry<T>> registrySupplier)
RequestHandlerRegistry(java.lang.String canonicalHostName, UriPatternType patternType)
RequestHandlerRegistry(UriPatternType patternType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private LookupRegistry<T>
getPatternMatcher(java.lang.String hostname)
void
register(java.lang.String hostname, java.lang.String uriPattern, T object)
T
resolve(HttpRequest request, HttpContext context)
Resolves a handler matching the given request.
-
-
-
Field Detail
-
LOCALHOST
private static final java.lang.String LOCALHOST
- See Also:
- Constant Field Values
-
IP_127_0_0_1
private static final java.lang.String IP_127_0_0_1
- See Also:
- Constant Field Values
-
canonicalHostName
private final java.lang.String canonicalHostName
-
registrySupplier
private final Supplier<LookupRegistry<T>> registrySupplier
-
primary
private final LookupRegistry<T> primary
-
virtualMap
private final java.util.concurrent.ConcurrentMap<java.lang.String,LookupRegistry<T>> virtualMap
-
-
Constructor Detail
-
RequestHandlerRegistry
public RequestHandlerRegistry(java.lang.String canonicalHostName, Supplier<LookupRegistry<T>> registrySupplier)
-
RequestHandlerRegistry
public RequestHandlerRegistry(java.lang.String canonicalHostName, UriPatternType patternType)
-
RequestHandlerRegistry
public RequestHandlerRegistry(UriPatternType patternType)
-
RequestHandlerRegistry
public RequestHandlerRegistry()
-
-
Method Detail
-
getPatternMatcher
private LookupRegistry<T> getPatternMatcher(java.lang.String hostname)
-
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 interfaceHttpRequestMapper<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(java.lang.String hostname, java.lang.String uriPattern, T object)
-
-