Open vicaba opened 10 months ago
Change is needed in the following files:
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyWebServer.java
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java
Associated test files are:
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jetty/src/main/java/smoketest/jetty/SampleJettyApplication.java
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webflux
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-tomcat/src/main/java/smoketest/tomcat/SampleTomcatApplication.java
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-undertow/src/main/java/smoketest/undertow/SampleUndertowApplication.java
org/apache/catalina/core/StandardContext.java
, setPath
does not allow converets "/"
to ""
. For TomcatWebServer
this means that we have to handle the output in-place.
return Arrays.stream(this.tomcat.getHost().findChildren())
.filter(TomcatEmbeddedContext.class::isInstance)
.map(TomcatEmbeddedContext.class::cast)
.map(context -> {
final String path = context.getPath();
if (path.isEmpty()) {
return "/";
}
return path;
})
.collect(Collectors.joining(" "));
While looking for tests or server implementations to see the results of my changes, I've found that there s no spring-boot-smoke-test-netty
, whereas there is a smoke tests for all other embedded servers (jetty, tomcat, undertow). Am I missing something or did I found another issue?
For Undertow, if we want to add a context path, we need to add a path handler: https://github.com/quarkusio/quarkus/commit/f6acf8b091e95da03faca4c689b59c1a340ffb30
Look for HttpHandler
in Servlet.
netty
string is Netty started on port 8080
, we should add context path.
This issue tracks issue 36149 of spring-boot.