tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amy...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup WebRuleSet.java
Date Thu, 08 Aug 2002 18:33:19 GMT
amyroh      2002/08/08 11:33:19

  Modified:    catalina/src/share/org/apache/catalina/startup
                        WebRuleSet.java
  Log:
  Better the log message with <deployment-extension> "namespace" attribute.
  
  Revision  Changes    Path
  1.3       +31 -31    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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WebRuleSet.java	7 Aug 2002 22:55:21 -0000	1.2
  +++ WebRuleSet.java	8 Aug 2002 18:33:19 -0000	1.3
  @@ -146,7 +146,7 @@
           digester.addCallParam(prefix + "web-app/context-param/param-value", 1);
   
           digester.addRule(prefix + "web-app/deployment-extension",
  -                         new SetDeploymentExtensionRule(digester));
  +                         new CheckDeploymentExtensionRule(digester));
   
           digester.addCallMethod(prefix + "web-app/display-name",
                                  "setDisplayName", 0);
  @@ -341,7 +341,7 @@
                               "org.apache.catalina.Container");
   
           digester.addRule(prefix + "web-app/servlet/deployment-extension",
  -                         new SetDeploymentExtensionRule(digester));
  +                         new CheckDeploymentExtensionRule(digester));
   
           digester.addCallMethod(prefix + "web-app/servlet/init-param",
                                  "addInitParameter", 2);
  @@ -393,52 +393,52 @@
   
   // ----------------------------------------------------------- Private Classes
   
  -
   /**
  - * A Rule that calls the <code>setAuthConstraint(true)</code> method of
  - * the top item on the stack, which must be of type
  - * <code>org.apache.catalina.deploy.SecurityConstraint</code>.
  + * 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 SetAuthConstraintRule extends Rule {
  +final class CheckDeploymentExtensionRule extends Rule {
   
  -    public SetAuthConstraintRule(Digester digester) {
  +    public CheckDeploymentExtensionRule(Digester digester) {
           super(digester);
       }
   
       public void begin(Attributes attributes) throws Exception {
  -        SecurityConstraint securityConstraint =
  -            (SecurityConstraint) digester.peek();
  -        securityConstraint.setAuthConstraint(true);
  -        if (digester.getDebug() > 0)
  -            digester.log("Calling SecurityConstraint.setAuthConstraint(true)");
  +        String mustUnderstand = attributes.getValue("mustUnderstand");
  +        if ((mustUnderstand != null) && (mustUnderstand.equals("true"))) {
  +            String namespace = attributes.getValue("namespace");
  +            if (digester.getDebug() > 0) {
  +                digester.log("Exception thrown CheckDeploymentExtensionRule");
  +            }
  +            throw new Exception("deployment-extension "+namespace+
  +            " attribute mustUnderstand is set to 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.
  + * A Rule that calls the <code>setAuthConstraint(true)</code> method of
  + * the top item on the stack, which must be of type
  + * <code>org.apache.catalina.deploy.SecurityConstraint</code>.
    */
   
  -final class SetDeploymentExtensionRule extends Rule {
  +final class SetAuthConstraintRule extends Rule {
   
  -    public SetDeploymentExtensionRule(Digester digester) {
  +    public SetAuthConstraintRule(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");
  -        }
  -
  +        SecurityConstraint securityConstraint =
  +            (SecurityConstraint) digester.peek();
  +        securityConstraint.setAuthConstraint(true);
  +        if (digester.getDebug() > 0)
  +            digester.log("Calling SecurityConstraint.setAuthConstraint(true)");
       }
   
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message