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(package private) static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BiFunction<String, URIAuthority, URIAuthority> private final Function<URIAuthority, Function<String, T>> private final HttpRequestMapper<T> static final BiFunction<String, URIAuthority, URIAuthority> static final URIAuthoritystatic final BiFunction<String, URIAuthority, URIAuthority> -
Constructor Summary
ConstructorsConstructorDescriptionRequestRouter(Function<URIAuthority, Function<String, T>> authorityRouter, BiFunction<String, URIAuthority, URIAuthority> authorityResolver, HttpRequestMapper<T> downstream) -
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) (package private) static final <T> Function<URIAuthority, T> resolve(HttpRequest request, HttpContext context) Resolves a handler matching the given request.
-
Field Details
-
LOCAL_AUTHORITY
-
LOCAL_AUTHORITY_RESOLVER
-
IGNORE_PORT_AUTHORITY_RESOLVER
-
authorityRouter
-
authorityResolver
-
downstream
-
-
Constructor Details
-
RequestRouter
RequestRouter(Function<URIAuthority, Function<String, T>> authorityRouter, BiFunction<String, URIAuthority, URIAuthority> authorityResolver, HttpRequestMapper<T> downstream)
-
-
Method Details
-
noAuthorityResolver
-
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.
-