Search in sources :

Example 1 with RouteType

use of org.webpieces.router.api.dto.RouteType in project webpieces by deanhiller.

the class RouteInvoker method invoke2.

public CompletableFuture<Void> invoke2(MatchResult result, RequestContext requestCtx, ResponseStreamer responseCb, ErrorRoutes errorRoutes) {
    //This makes us consistent with other NotFoundExceptions and without the cost of 
    //throwing an exception and filling in stack trace...
    //We could convert the exc. to FastException and override method so stack is not filled in but that
    //can get very annoying
    RouteMeta meta = result.getMeta();
    Route route = meta.getRoute();
    RouteType routeType = route.getRouteType();
    if (routeType == RouteType.NOT_FOUND) {
        CompletableFuture<Void> future = new CompletableFuture<Void>();
        future.completeExceptionally(new NotFoundException("route not found"));
        return future;
    }
    return invokeImpl(result, meta.getService222(), requestCtx, responseCb);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) RouteType(org.webpieces.router.api.dto.RouteType) NotFoundException(org.webpieces.router.api.exceptions.NotFoundException)

Aggregations

CompletableFuture (java.util.concurrent.CompletableFuture)1 RouteType (org.webpieces.router.api.dto.RouteType)1 NotFoundException (org.webpieces.router.api.exceptions.NotFoundException)1