diff --git a/README.md b/README.md index a1530083f..3bc4404e5 100644 --- a/README.md +++ b/README.md @@ -107,8 +107,6 @@ This project is essentially pieces that can be used to build any http related so * core/runtimecompiler - create a compiler with a list of source paths and then just use this to call compiler.getClass(String className) and it will automatically recompile when it needs to. this is only used in the dev servers and is not on any production classpaths (unlike play 1.4.x) #### TODO: -* look into bug then another bug...need test and fix -* post not found was quirky so fix with redirect instead of render and test * start an actual multi-homed project * add more and more tag examples * move examples to @examples url instead diff --git a/webserver/http-router/src/main/java/org/webpieces/router/impl/RouteInvoker.java b/webserver/http-router/src/main/java/org/webpieces/router/impl/RouteInvoker.java index 867c09f74..e48c40bb6 100644 --- a/webserver/http-router/src/main/java/org/webpieces/router/impl/RouteInvoker.java +++ b/webserver/http-router/src/main/java/org/webpieces/router/impl/RouteInvoker.java @@ -62,14 +62,20 @@ public RouteInvoker( public CompletableFuture invoke(MatchResult result, RequestContext requestCtx, ResponseStreamer responseCb, ErrorRoutes errorRoutes) { - return invokeImpl(result, responseCb, errorRoutes, requestCtx); - } - - public CompletableFuture invokeImpl( - MatchResult result, ResponseStreamer responseCb, ErrorRoutes errorRoutes, RequestContext requestCtx) { - //We convert all exceptions from invokeAsync into CompletableFuture.. - return invokeAsync(result, requestCtx, responseCb, errorRoutes); - //future.exceptionally(e -> processException(responseCb, requestCtx, e, errorRoutes, result.getMeta())); + //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) { + processException(responseCb, requestCtx, null, errorRoutes, null); + //This is a special case....check the NotFound tests + return CompletableFuture.completedFuture(null); + } + + return invokeImpl(result, meta.getService222(), requestCtx, responseCb); } public Void processException(ResponseStreamer responseCb, RequestContext requestCtx, Throwable e, ErrorRoutes errorRoutes, Object meta) { @@ -106,24 +112,6 @@ public Void finalFailure(ResponseStreamer responseCb, Throwable e, RequestContex return null; } - public CompletableFuture invokeAsync( - MatchResult result, RequestContext reqCtx, ResponseStreamer responseCb, ErrorRoutes notFoundRoute) { - //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) { - processException(responseCb, reqCtx, null, notFoundRoute, null); - //This is a special case....check the NotFound tests - return CompletableFuture.completedFuture(null); - } - - return invokeImpl(result, meta.getService222(), reqCtx, responseCb); - } - private CompletableFuture notFound(RouteMeta notFoundResult, Service service, NotFoundException exc, RequestContext requestCtx, ResponseStreamer responseCb) { try { MatchResult notFoundRes = new MatchResult(notFoundResult);