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
pull/17511/head
Andy Wilkinson 5 years ago
parent e57579461a
commit 82fd4ce9b9

@ -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);

Loading…
Cancel
Save