Top Description Fields Constructors Methods
org.apache.hc.core5.http.protocol

public Class RequestHandlerRegistry<T>

extends Object
implements HttpRequestMapper<T>
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.HttpRequestMapper
Annotations
@Contract
threading:SAFE_CONDITIONAL
Type Parameters
<T>
request handler type.
Imports
java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.function.Supplier, org.apache.hc.core5.http.HttpRequest, .HttpRequestMapper, .MisdirectedRequestException, org.apache.hc.core5.net.URIAuthority, org.apache.hc.core5.util.Args, .TextUtils

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

Field Summary

Modifier and TypeField and Description
private final String
private static final String
private static final String
private final LookupRegistry<T>
private final Supplier<LookupRegistry<T>>
private final ConcurrentMap<String, LookupRegistry<T>>

Constructor Summary

AccessConstructor and Description
public
RequestHandlerRegistry(final String canonicalHostName, final Supplier<LookupRegistry<T>> registrySupplier)

public
RequestHandlerRegistry(final String canonicalHostName, final UriPatternType patternType)

public
public

Method Summary

Modifier and TypeMethod and Description
private LookupRegistry<T>
getPatternMatcher(final String hostname)

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

public T
resolve(final HttpRequest
the request to map to a handler
request
,
final HttpContext context)

Implements org.apache.hc.core5.http.HttpRequestMapper.resolve.

Resolves a handler matching the given request.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

canonicalHostNameback to summary
private final String canonicalHostName
IP_127_0_0_1back to summary
private static final String IP_127_0_0_1
LOCALHOSTback to summary
private static final String LOCALHOST
primaryback to summary
private final LookupRegistry<T> primary
registrySupplierback to summary
private final Supplier<LookupRegistry<T>> registrySupplier
virtualMapback to summary
private final ConcurrentMap<String, LookupRegistry<T>> virtualMap

Constructor Detail

RequestHandlerRegistryback to summary
public RequestHandlerRegistry(final String canonicalHostName, final Supplier<LookupRegistry<T>> registrySupplier)
RequestHandlerRegistryback to summary
public RequestHandlerRegistry(final String canonicalHostName, final UriPatternType patternType)
RequestHandlerRegistryback to summary
public RequestHandlerRegistry(final UriPatternType patternType)
RequestHandlerRegistryback to summary
public RequestHandlerRegistry()

Method Detail

getPatternMatcherback to summary
private LookupRegistry<T> getPatternMatcher(final String hostname)
registerback to summary
public void register(final String hostname, final String uriPattern, final T object)
resolveback to summary
public T resolve(final HttpRequest request, final HttpContext context) throws MisdirectedRequestException

Implements org.apache.hc.core5.http.HttpRequestMapper.resolve.

Doc from org.apache.hc.core5.http.HttpRequestMapper.resolve.

Resolves a handler matching the given request.

Parameters
request:HttpRequest

the request to map to a handler

Returns:T

HTTP request handler or null if no match is found.

Annotations
@Override