Skip to content

Commit

Permalink
Fix access log handling for root and non-root paths
Browse files Browse the repository at this point in the history
  • Loading branch information
xstefank committed Oct 13, 2022
1 parent 2e7bba4 commit 0e100af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,8 @@ ServiceStartBuildItem finalizeRouter(
defaultRoute.map(DefaultRouteBuildItem::getRoute).orElse(null),
listOfFilters, vertx.getVertx(), lrc, mainRouter, httpRouteRouter.getHttpRouter(),
httpRouteRouter.getMutinyRouter(), httpRouteRouter.getFrameworkRouter(),
nonApplicationRootPathBuildItem.isDedicatedRouterRequired(),
nonApplicationRootPathBuildItem.isAttachedToMainRouter(),
httpRootPathBuildItem.getRootPath(),
nonApplicationRootPathBuildItem.getNonApplicationRootPath(),
launchMode.getLaunchMode(),
!requireBodyHandlerBuildItems.isEmpty(), bodyHandler, gracefulShutdownFilter,
shutdownConfig, executorBuildItem.getExecutorProxy());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ public void finalizeRouter(BeanContainer container, Consumer<Route> defaultRoute
LiveReloadConfig liveReloadConfig, Optional<RuntimeValue<Router>> mainRouterRuntimeValue,
RuntimeValue<Router> httpRouterRuntimeValue, RuntimeValue<io.vertx.mutiny.ext.web.Router> mutinyRouter,
RuntimeValue<Router> frameworkRouter,
boolean nonApplicationDedicatedRouter, boolean nonApplicationAttachedToMainRouter,
String rootPath, LaunchMode launchMode, boolean requireBodyHandler,
String rootPath, String nonRootPath,
LaunchMode launchMode, boolean requireBodyHandler,
Handler<RoutingContext> bodyHandler,
GracefulShutdownFilter gracefulShutdownFilter, ShutdownConfig shutdownConfig,
Executor executor) {
Expand Down Expand Up @@ -560,10 +560,17 @@ public void handle(HttpServerRequest event) {
}
AccessLogHandler handler = new AccessLogHandler(receiver, accessLog.pattern, getClass().getClassLoader(),
accessLog.excludePattern);
if (nonApplicationDedicatedRouter && !nonApplicationAttachedToMainRouter) {
if (rootPath.equals("/") || nonRootPath.equals("/")) {
mainRouterRuntimeValue.orElse(httpRouterRuntimeValue).getValue().route().order(Integer.MIN_VALUE)
.handler(handler);
} else if (nonRootPath.startsWith(rootPath)) {
httpRouteRouter.route().order(Integer.MIN_VALUE).handler(handler);
} else if (rootPath.startsWith(nonRootPath)) {
frameworkRouter.getValue().route().order(Integer.MIN_VALUE).handler(handler);
} else {
httpRouteRouter.route().order(Integer.MIN_VALUE).handler(handler);
frameworkRouter.getValue().route().order(Integer.MIN_VALUE).handler(handler);
}
httpRouteRouter.route().order(Integer.MIN_VALUE).handler(handler);

quarkusWrapperNeeded = true;
}
Expand Down

0 comments on commit 0e100af

Please sign in to comment.