Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B66DD66D1 for ; Wed, 8 Jun 2011 00:44:36 +0000 (UTC) Received: (qmail 49908 invoked by uid 500); 8 Jun 2011 00:44:35 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 49847 invoked by uid 500); 8 Jun 2011 00:44:35 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 49838 invoked by uid 99); 8 Jun 2011 00:44:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2011 00:44:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2011 00:44:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 785A12388900; Wed, 8 Jun 2011 00:44:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1133221 - in /tomcat/trunk: java/org/apache/catalina/deploy/WebXml.java java/org/apache/catalina/startup/ContextConfig.java webapps/docs/changelog.xml Date: Wed, 08 Jun 2011 00:44:14 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110608004414.785A12388900@eris.apache.org> Author: markt Date: Wed Jun 8 00:44:14 2011 New Revision: 1133221 URL: http://svn.apache.org/viewvc?rev=1133221&view=rev Log: Fix regression in welcome file processing Modified: tomcat/trunk/java/org/apache/catalina/deploy/WebXml.java tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/catalina/deploy/WebXml.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/WebXml.java?rev=1133221&r1=1133220&r2=1133221&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/deploy/WebXml.java (original) +++ tomcat/trunk/java/org/apache/catalina/deploy/WebXml.java Wed Jun 8 00:44:14 2011 @@ -346,13 +346,25 @@ public class WebXml { } public Map getMimeMappings() { return mimeMappings; } - // welcome-file-list - // When merging web.xml files it may be necessary for any new welcome files - // to completely replace the current set + // welcome-file-list merge control private boolean replaceWelcomeFiles = false; + private boolean alwaysAddWelcomeFiles = true; + /** + * When merging/parsing web.xml files into this web.xml should the current + * set be completely replaced? + */ public void setReplaceWelcomeFiles(boolean replaceWelcomeFiles) { this.replaceWelcomeFiles = replaceWelcomeFiles; } + /** + * When merging from this web.xml, should the welcome files be added to the + * target web.xml even if it already contains welcome file definitions. + */ + public void setAlwaysAddWelcomeFiles(boolean alwaysAddWelcomeFiles) { + this.alwaysAddWelcomeFiles = alwaysAddWelcomeFiles; + } + + // welcome-file-list private Set welcomeFiles = new LinkedHashSet(); public void addWelcomeFile(String welcomeFile) { if (replaceWelcomeFiles) { @@ -1322,7 +1334,16 @@ public class WebXml { // Context doesn't use version directly for (String welcomeFile : welcomeFiles) { - context.addWelcomeFile(welcomeFile); + /* + * The following will result in a welcome file of "" so don't add + * that to the context + * + * + * + */ + if (welcomeFile != null && welcomeFile.length() > 0) { + context.addWelcomeFile(welcomeFile); + } } // Do this last as it depends on servlets @@ -1848,9 +1869,10 @@ public class WebXml { taglibs.putAll(temp.getTaglibs()); for (WebXml fragment : fragments) { - for (String welcomeFile : fragment.getWelcomeFiles()) { - // Always additive - addWelcomeFile(welcomeFile); + if (fragment.alwaysAddWelcomeFiles || welcomeFiles.size() == 0) { + for (String welcomeFile : fragment.getWelcomeFiles()) { + addWelcomeFile(welcomeFile); + } } } Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1133221&r1=1133220&r2=1133221&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Wed Jun 8 00:44:14 2011 @@ -1199,6 +1199,9 @@ public class ContextConfig // distributable when the default fragment is merged with the main // web.xml webXmlDefaultFragment.setDistributable(true); + // When merging, the default welcome files are only used if the app has + // not defined any welcomes files. + webXmlDefaultFragment.setAlwaysAddWelcomeFiles(false); // Parse global web.xml if present InputSource globalWebXml = getGlobalWebXmlSource(); @@ -1211,7 +1214,7 @@ public class ContextConfig // Parse host level web.xml if present // Additive apart from welcome pages - webXml.setReplaceWelcomeFiles(true); + webXmlDefaultFragment.setReplaceWelcomeFiles(true); InputSource hostWebXml = getHostWebXmlSource(); parseWebXml(hostWebXml, webXmlDefaultFragment, false); Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1133221&r1=1133220&r2=1133221&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Jun 8 00:44:14 2011 @@ -60,6 +60,10 @@ web application from being marked as distributable. (kfujino/mark) + Correct a regression in the fix for 51278 that prevented a + web application from overriding the default welcome files. (mark) + + Enable remaining valves for Servlet 3 asynchronous processing support. (markt) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org