use of org.webpieces.router.api.exceptions.NotFoundException 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);
}
use of org.webpieces.router.api.exceptions.NotFoundException in project webpieces by deanhiller.
the class RouteInvoker method processNotFound.
public CompletableFuture<Void> processNotFound(ResponseStreamer responseCb, RequestContext requestCtx, NotFoundException e, ErrorRoutes errorRoutes, Object meta) {
NotFoundException exc = (NotFoundException) e;
NotFoundInfo notFoundInfo = errorRoutes.fetchNotfoundRoute(exc);
RouteMeta notFoundResult = notFoundInfo.getResult();
RouterRequest overridenRequest = notFoundInfo.getReq();
RequestContext overridenCtx = new RequestContext(requestCtx.getValidation(), (FlashSub) requestCtx.getFlash(), requestCtx.getSession(), overridenRequest);
//http 404...(unless an exception happens in calling this code and that then goes to 500)
return notFound(notFoundResult, notFoundInfo.getService(), exc, overridenCtx, responseCb);
}
use of org.webpieces.router.api.exceptions.NotFoundException in project webpieces by deanhiller.
the class StaticFileReader method fetchFile.
private Path fetchFile(String msg, String fullFilePath) {
Path file = Paths.get(fullFilePath);
File f = file.toFile();
if (!f.exists() || !f.isFile())
throw new NotFoundException(msg + file + " was not found");
return file;
}
Aggregations