This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 0673aa0a3b Ensure application configured welcome files override the
defaults
0673aa0a3b is described below
commit 0673aa0a3ba2aba6f53405a178a5cd1fcacc5f23
Author: Mark Thomas <[email protected]>
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 be4e4a4291..716ed2b4ae 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -992,7 +992,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
*/
@@ -1034,11 +1033,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 100bf8f943..5ae43f6442 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 11.0.9 (markt)" 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: [email protected]
For additional commands, e-mail: [email protected]