vicaba / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
0 stars 0 forks source link

Log WebServer's context path consistently (track) #1

Open vicaba opened 10 months ago

vicaba commented 10 months ago

This issue tracks issue 36149 of spring-boot.

vicaba commented 10 months ago

Change is needed in the following files:

vicaba commented 10 months ago

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.

vicaba commented 10 months ago
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(" "));
vicaba commented 10 months ago

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?

vicaba commented 10 months ago

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.

vicaba commented 10 months ago

netty string is Netty started on port 8080, we should add context path.