Class RequestRouter<T>
java.lang.Object
org.apache.hc.core5.http.impl.routing.RequestRouter<T>
- Type Parameters:
T- request handler type.
- All Implemented Interfaces:
HttpRequestMapper<T>
@Contract(threading=IMMUTABLE)
public class RequestRouter<T>
extends Object
implements HttpRequestMapper<T>
Request mapper that can route requests based on their properties to a specific request handler.
- Since:
- 5.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BiFunction<String,URIAuthority, URIAuthority> static final URIAuthoritystatic final BiFunction<String,URIAuthority, URIAuthority> -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> RequestRouter.Builder<T>builder()static <T> RequestRouter.Builder<T>builder(UriPatternType patternType) static <T> RequestRouter<T>create(URIAuthority primaryAuthority, UriPatternType patternType, List<RequestRouter.Entry<T>> handlerEntries, BiFunction<String, URIAuthority, URIAuthority> authorityResolver, HttpRequestMapper<T> downstream) resolve(HttpRequest request, HttpContext context) Resolves a handler matching the given request.
-
Field Details
-
LOCAL_AUTHORITY
-
LOCAL_AUTHORITY_RESOLVER
-
IGNORE_PORT_AUTHORITY_RESOLVER
-
-
Method Details
-
create
@Internal public static <T> RequestRouter<T> create(URIAuthority primaryAuthority, UriPatternType patternType, List<RequestRouter.Entry<T>> handlerEntries, BiFunction<String, URIAuthority, URIAuthority> authorityResolver, HttpRequestMapper<T> downstream) -
builder
-
builder
-
resolve
Description copied from interface:HttpRequestMapperResolves a handler matching the given request.- Specified by:
resolvein interfaceHttpRequestMapper<T>- Parameters:
request- the request to map to a handler- Returns:
- HTTP request handler or
nullif no match is found. - Throws:
HttpException- in case of an HTTP protocol violation.
-