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
This commit is contained in:
Andy Wilkinson 2019-07-02 17:24:34 +01:00
parent e57579461a
commit 82fd4ce9b9
1 changed files with 1 additions and 1 deletions

View File

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