Skip to content

Commit

Permalink
Add access log handler to the main router if non-app root-path is dif…
Browse files Browse the repository at this point in the history
…ferent from root-path
  • Loading branch information
xstefank committed Jul 18, 2022
1 parent 0025aff commit d4abc33
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ ServiceStartBuildItem finalizeRouter(
defaultRoute.map(DefaultRouteBuildItem::getRoute).orElse(null),
listOfFilters, vertx.getVertx(), lrc, mainRouter, httpRouteRouter.getHttpRouter(),
httpRouteRouter.getMutinyRouter(),
nonApplicationRootPathBuildItem.isDedicatedRouterRequired(),
nonApplicationRootPathBuildItem.isAttachedToMainRouter(),
httpRootPathBuildItem.getRootPath(),
launchMode.getLaunchMode(),
!requireBodyHandlerBuildItems.isEmpty(), bodyHandler, gracefulShutdownFilter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ public void finalizeRouter(BeanContainer container, Consumer<Route> defaultRoute
List<Filter> filterList, Supplier<Vertx> vertx,
LiveReloadConfig liveReloadConfig, Optional<RuntimeValue<Router>> mainRouterRuntimeValue,
RuntimeValue<Router> httpRouterRuntimeValue, RuntimeValue<io.vertx.mutiny.ext.web.Router> mutinyRouter,
boolean nonApplicationDedicatedRouter, boolean nonApplicationAttachedToMainRouter,
String rootPath, LaunchMode launchMode, boolean requireBodyHandler,
Handler<RoutingContext> bodyHandler,
GracefulShutdownFilter gracefulShutdownFilter, ShutdownConfig shutdownConfig,
Expand Down Expand Up @@ -552,7 +553,14 @@ public void handle(HttpServerRequest event) {
}
AccessLogHandler handler = new AccessLogHandler(receiver, accessLog.pattern, getClass().getClassLoader(),
accessLog.excludePattern);
httpRouteRouter.route().order(Integer.MIN_VALUE).handler(handler);
if (nonApplicationDedicatedRouter && !nonApplicationAttachedToMainRouter) {
// new mainRouter was created nesting both application and non-application routers
Router mainRouter = mainRouterRuntimeValue.isPresent() ? mainRouterRuntimeValue.get().getValue()
: Router.router(vertx.get());
mainRouter.route().order(Integer.MIN_VALUE).handler(handler);
} else {
httpRouteRouter.route().order(Integer.MIN_VALUE).handler(handler);
}
quarkusWrapperNeeded = true;
}

Expand Down

0 comments on commit d4abc33

Please sign in to comment.