You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by am...@apache.org on 2002/08/08 00:55:22 UTC

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup WebRuleSet.java

amyroh      2002/08/07 15:55:21

  Modified:    catalina/src/share/org/apache/catalina/startup
                        WebRuleSet.java
  Log:
  Add a rule for new Servlet 2.4's ability to extend the deployment descriptor
  <deployment-extention>.
  
  Revision  Changes    Path
  1.2       +37 -4     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/WebRuleSet.java
  
  Index: WebRuleSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/WebRuleSet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WebRuleSet.java	18 Jul 2002 16:47:48 -0000	1.1
  +++ WebRuleSet.java	7 Aug 2002 22:55:21 -0000	1.2
  @@ -145,6 +145,9 @@
           digester.addCallParam(prefix + "web-app/context-param/param-name", 0);
           digester.addCallParam(prefix + "web-app/context-param/param-value", 1);
   
  +        digester.addRule(prefix + "web-app/deployment-extension",
  +                         new SetDeploymentExtensionRule(digester));
  +
           digester.addCallMethod(prefix + "web-app/display-name",
                                  "setDisplayName", 0);
   
  @@ -337,6 +340,9 @@
                               "addChild",
                               "org.apache.catalina.Container");
   
  +        digester.addRule(prefix + "web-app/servlet/deployment-extension",
  +                         new SetDeploymentExtensionRule(digester));
  +
           digester.addCallMethod(prefix + "web-app/servlet/init-param",
                                  "addInitParameter", 2);
           digester.addCallParam(prefix + "web-app/servlet/init-param/param-name",
  @@ -406,6 +412,33 @@
           securityConstraint.setAuthConstraint(true);
           if (digester.getDebug() > 0)
               digester.log("Calling SecurityConstraint.setAuthConstraint(true)");
  +    }
  +
  +}
  +
  +
  +/**
  + * A Rule that checks mustUnderstand attribute.  It throws an Exception if
  + * mustUnderstand attribute is true since stand-alone Tomcat currently does
  + * not have a way of recognizing an extension within a deployment descriptor.
  + */
  +
  +final class SetDeploymentExtensionRule extends Rule {
  +
  +    public SetDeploymentExtensionRule(Digester digester) {
  +        super(digester);
  +    }
  +
  +    public void begin(Attributes attributes) throws Exception {
  +        String mustUnderstand = attributes.getValue("mustUnderstand");
  +        if ((mustUnderstand != null) && (mustUnderstand.equals("true"))) {
  +            if (digester.getDebug() > 0) {
  +                digester.log("Exception in SetDeploymentExtensionRule");
  +            }
  +            throw new Exception(
  +            "deployment-extension attribute mustUnderstand is set to true");
  +        }
  +
       }
   
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>