From 82fd4ce9b9f12d85d1ed0888c591fabe49e9ee3f Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 2 Jul 2019 17:24:34 +0100 Subject: [PATCH] Fix empty context path warning when using Jetty with WebFlux Previously, the context path was set to an empty string. The led to Jetty logging a warning about an empty context path and then using / instead. This commit avoids the warning while leaving the context path's end result unchanged by setting the context path to /. Closes gh-17399 --- .../boot/web/embedded/jetty/JettyReactiveWebServerFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java index 53bf14dcdc3..53c93f124d9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java @@ -173,7 +173,7 @@ public class JettyReactiveWebServerFactory extends AbstractReactiveWebServerFact server.addConnector(createConnector(address, server)); ServletHolder servletHolder = new ServletHolder(servlet); servletHolder.setAsyncSupported(true); - ServletContextHandler contextHandler = new ServletContextHandler(server, "", false, false); + ServletContextHandler contextHandler = new ServletContextHandler(server, "/", false, false); contextHandler.addServlet(servletHolder, "/"); server.setHandler(addHandlerWrappers(contextHandler)); JettyReactiveWebServerFactory.logger.info("Server initialized with port: " + port);