Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 40111 invoked from network); 10 Jul 2009 15:54:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Jul 2009 15:54:15 -0000 Received: (qmail 13366 invoked by uid 500); 10 Jul 2009 15:54:24 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 13094 invoked by uid 500); 10 Jul 2009 15:54:23 -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 13071 invoked by uid 99); 10 Jul 2009 15:54:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jul 2009 15:54:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Fri, 10 Jul 2009 15:54:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E521E23888D9; Fri, 10 Jul 2009 15:53:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r792996 - /tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java Date: Fri, 10 Jul 2009 15:53:59 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090710155359.E521E23888D9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: markt Date: Fri Jul 10 15:53:59 2009 New Revision: 792996 URL: http://svn.apache.org/viewvc?rev=792996&view=rev Log: Correct location of taglib element varies with spec version. WebRuleSet was using 2.3 and earlier location. Update it to a) support 2.4 and later as well as 2.3 and earlier b) complain if taglib definition location is not consistent with declared spec version. Modified: tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java Modified: tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java?rev=792996&r1=792995&r2=792996&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/WebRuleSet.java Fri Jul 10 15:53:59 2009 @@ -301,11 +301,20 @@ new Class[] { Integer.TYPE }); digester.addCallParam(prefix + "web-app/session-config/session-timeout", 0); + // Taglibs pre Servlet 2.4 + digester.addRule(prefix + "web-app/taglib", new TaglibLocationRule(false)); digester.addCallMethod(prefix + "web-app/taglib", "addTaglib", 2); digester.addCallParam(prefix + "web-app/taglib/taglib-location", 1); digester.addCallParam(prefix + "web-app/taglib/taglib-uri", 0); + // Taglibs Servlet 2.4 onwards + digester.addRule(prefix + "web-app/jsp-config/taglib", new TaglibLocationRule(true)); + digester.addCallMethod(prefix + "web-app/jsp-config/taglib", + "addTaglib", 2); + digester.addCallParam(prefix + "web-app/jsp-config/taglib/taglib-location", 1); + digester.addCallParam(prefix + "web-app/jsp-config/taglib/taglib-uri", 0); + digester.addCallMethod(prefix + "web-app/welcome-file-list/welcome-file", "addWelcomeFile", 0); @@ -925,5 +934,32 @@ contextService.setServiceqnameLocalpart(localpart); contextService.setServiceqnameNamespaceURI(namespaceuri); } + } +/** + * A rule that checks if the taglib element is in the right place. + */ +final class TaglibLocationRule extends Rule { + + final boolean isServlet24OrLater; + + public TaglibLocationRule(boolean isServlet24OrLater) { + this.isServlet24OrLater = isServlet24OrLater; + } + + @Override + public void begin(String namespace, String name, Attributes attributes) + throws Exception { + Context context = (Context) digester.peek(digester.getCount() - 1); + // If we have a public ID, this is not a 2.4 or later webapp + boolean havePublicId = (context.getPublicId() != null); + // havePublicId and isServlet24OrLater should be mutually exclusive + if (havePublicId == isServlet24OrLater) { + throw new IllegalArgumentException( + "taglib definition not consistent with specification version"); + } + } + + +} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org