@Singleton public class DefaultRouter extends Object implements Router
The default Router implementation. This implementation does not perform any additional caching of
 route discovery.
| Constructor and Description | 
|---|
DefaultRouter(Collection<RouteBuilder> builders)
Construct a new router for the given route builders. 
 | 
DefaultRouter(RouteBuilder... builders)
Construct a new router for the given route builders. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
<T,R> Stream<UriRouteMatch<T,R>> | 
find(HttpMethod httpMethod,
    CharSequence uri)
Finds all of the possible routes for the given HTTP method and URI. 
 | 
<T,R> Stream<UriRouteMatch<T,R>> | 
find(HttpMethod httpMethod,
    CharSequence uri,
    HttpRequest<?> context)
Finds all of the possible routes for the given HTTP method and URI. 
 | 
<T,R> Stream<UriRouteMatch<T,R>> | 
find(HttpRequest<?> request)
Finds all of the possible routes for the given HTTP request. 
 | 
<T,R> List<UriRouteMatch<T,R>> | 
findAllClosest(HttpRequest<?> request)
Finds the closest match for the given request. 
 | 
<T,R> Stream<UriRouteMatch<T,R>> | 
findAny(CharSequence uri)
Find any  
RouteMatch regardless of HTTP method. | 
<T,R> Stream<UriRouteMatch<T,R>> | 
findAny(CharSequence uri,
       HttpRequest<?> context)
Find any  
RouteMatch regardless of HTTP method. | 
List<HttpFilter> | 
findFilters(HttpRequest<?> request)
Build a filtered  
Publisher for an action. | 
<R> Optional<RouteMatch<R>> | 
route(Class originatingClass,
     HttpStatus status)
Found a  
RouteMatch for the given HttpStatus code. | 
<R> Optional<RouteMatch<R>> | 
route(Class originatingClass,
     Throwable error)
Match a route to an error. 
 | 
<T,R> Optional<UriRouteMatch<T,R>> | 
route(HttpMethod httpMethod,
     CharSequence uri)
Finds the first possible route for the given HTTP method and URI. 
 | 
<R> Optional<RouteMatch<R>> | 
route(HttpStatus status)
Found a  
RouteMatch for the given HttpStatus code. | 
<R> Optional<RouteMatch<R>> | 
route(Throwable error)
Match a route to an error. 
 | 
Stream<UriRoute> | 
uriRoutes()
Returns all UriRoutes. 
 | 
@Inject public DefaultRouter(Collection<RouteBuilder> builders)
builders - The builderspublic DefaultRouter(RouteBuilder... builders)
builders - The builders@Nonnull public <T,R> Stream<UriRouteMatch<T,R>> find(@Nonnull HttpMethod httpMethod, @Nonnull CharSequence uri)
Router@Nonnull public <T,R> Stream<UriRouteMatch<T,R>> find(@Nonnull HttpMethod httpMethod, @Nonnull CharSequence uri, @Nullable HttpRequest<?> context)
Routerfind in interface RouterT - The target typeR - The typehttpMethod - The HTTP methoduri - The URI route matchcontext - The optional HttpRequest context information to apply RouteMatchFilter.Stream of possible Route instances.@Nonnull public <T,R> List<UriRouteMatch<T,R>> findAllClosest(@Nonnull HttpRequest<?> request)
RouterfindAllClosest in interface RouterT - The target typeR - The typerequest - The requestList of possible Route instances.@Nonnull public <T,R> Stream<UriRouteMatch<T,R>> find(@Nonnull HttpRequest<?> request)
Router@Nonnull public Stream<UriRoute> uriRoutes()
Routerpublic <T,R> Optional<UriRouteMatch<T,R>> route(@Nonnull HttpMethod httpMethod, @Nonnull CharSequence uri)
Routerpublic <R> Optional<RouteMatch<R>> route(@Nonnull HttpStatus status)
RouterRouteMatch for the given HttpStatus code.route in interface RouterR - The matched routestatus - The HTTP statusRouteMatchpublic <R> Optional<RouteMatch<R>> route(@Nonnull Class originatingClass, @Nonnull HttpStatus status)
RouterRouteMatch for the given HttpStatus code.route in interface RouterR - The matched routeoriginatingClass - The class the error originates fromstatus - The HTTP statusRouteMatchpublic <R> Optional<RouteMatch<R>> route(@Nonnull Class originatingClass, @Nonnull Throwable error)
Routerroute in interface RouterR - The matched routeoriginatingClass - The class the error originates fromerror - The errorRouteMatchpublic <R> Optional<RouteMatch<R>> route(@Nonnull Throwable error)
Routerroute in interface RouterR - The matched routeerror - The errorRouteMatch@Nonnull public List<HttpFilter> findFilters(@Nonnull HttpRequest<?> request)
RouterPublisher for an action.findFilters in interface Routerrequest - The request@Nonnull public <T,R> Stream<UriRouteMatch<T,R>> findAny(@Nonnull CharSequence uri)
RouterRouteMatch regardless of HTTP method.@Nonnull public <T,R> Stream<UriRouteMatch<T,R>> findAny(@Nonnull CharSequence uri, @Nullable HttpRequest<?> context)
RouterRouteMatch regardless of HTTP method.findAny in interface RouterT - The target typeR - The return typeuri - The URIcontext - The optional HttpRequest context information to apply RouteMatchFilter.