Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
deanhiller committed May 2, 2017
1 parent e88723d commit 6e19f96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,20 @@ public RouteInvoker(

public CompletableFuture<Void> invoke(MatchResult result, RequestContext requestCtx, ResponseStreamer responseCb, ErrorRoutes errorRoutes) {

return invokeImpl(result, responseCb, errorRoutes, requestCtx);
}

public CompletableFuture<Void> 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) {
Expand Down Expand Up @@ -106,24 +112,6 @@ public Void finalFailure(ResponseStreamer responseCb, Throwable e, RequestContex
return null;
}

public CompletableFuture<Void> 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<Void> notFound(RouteMeta notFoundResult, Service<MethodMeta, Action> service, NotFoundException exc, RequestContext requestCtx, ResponseStreamer responseCb) {
try {
MatchResult notFoundRes = new MatchResult(notFoundResult);
Expand Down

0 comments on commit 6e19f96

Please sign in to comment.