This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new d1a7786653 Ensure application configured welcome files override the 
defaults
d1a7786653 is described below

commit d1a7786653e9cf3dd57f71742301e362dc8cf430
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jun 12 12:01:38 2025 +0100

    Ensure application configured welcome files override the defaults
    
    Also fix a typo and remove a completed TODO
---
 java/org/apache/catalina/startup/Tomcat.java | 7 +++++--
 webapps/docs/changelog.xml                   | 8 ++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/startup/Tomcat.java 
b/java/org/apache/catalina/startup/Tomcat.java
index 51a67fcb9b..4d6580aece 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -993,7 +993,6 @@ public class Tomcat {
      * <li>MIME mappings (subset of those in conf/web.xml)</li>
      * <li>Welcome files</li>
      * </ul>
-     * TODO: Align the MIME mappings with conf/web.xml - possibly via a common 
file.
      *
      * @param contextPath The path of the context to set the defaults for
      */
@@ -1035,11 +1034,15 @@ public class Tomcat {
         ctx.addWelcomeFile("index.html");
         ctx.addWelcomeFile("index.htm");
         ctx.addWelcomeFile("index.jsp");
+        // Any application configured welcome files should override the 
defaults.
+        if (ctx instanceof StandardContext stdCtx) {
+            stdCtx.setReplaceWelcomeFiles(true);
+        }
     }
 
 
     /**
-     * Add the default MIME type mappings to the provide Context.
+     * Add the default MIME type mappings to the provided Context.
      *
      * @param context The web application to which the default MIME type 
mappings should be added.
      */
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3244bcc3f1..dde19b8de9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,14 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 10.1.43 (schultz)" rtext="in development">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        Ensure application configured welcome files override the defaults when
+        configuring an embedded web application programmatically. (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Web applications">
     <changelog>
       <add>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to