yoavs       2004/08/31 07:50:41

  Modified:    catalina/src/share/org/apache/catalina/core Tag: TOMCAT_5_0
                        StandardContext.java
               webapps/docs Tag: TOMCAT_5_0 changelog.xml
               webapps/docs/config Tag: TOMCAT_5_0 context.xml
  Log:
  Added StandardContext processTlds attribute, added context configuration references 
docs for processTlds, tldValidation, tldNamespaceAware.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.130.2.3 +60 -30    
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.130.2.2
  retrieving revision 1.130.2.3
  diff -u -r1.130.2.2 -r1.130.2.3
  --- StandardContext.java      28 Aug 2004 23:57:02 -0000      1.130.2.2
  +++ StandardContext.java      31 Aug 2004 14:50:41 -0000      1.130.2.3
  @@ -602,6 +602,10 @@
        */
        private boolean webXmlNamespaceAware = false;
   
  +    /**
  +     * Attribute value used to turn on/off TLD processing
  +     */
  +    private boolean processTlds = true;
   
       /**
        * Attribute value used to turn on/off XML validation
  @@ -4254,37 +4258,13 @@
   
                   // Start the Valves in our pipeline (including the basic),
                   // if any
  -                if (pipeline instanceof Lifecycle)
  +                if (pipeline instanceof Lifecycle) {
                       ((Lifecycle) pipeline).start();
  +             }
   
  -                // Read tldListeners. XXX Option to disable
  -                TldConfig tldConfig = new TldConfig();
  -                tldConfig.setContext(this);
  -
  -                // (1)  check if the attribute has been defined
  -                //      on the context element.
  -                tldConfig.setTldValidation(tldValidation);
  -                tldConfig.setTldNamespaceAware(tldNamespaceAware);
  -
  -                // (2) if the attribute wasn't defined on the context
  -                //     try the host.
  -                if (!tldValidation){
  -                    tldConfig.setTldValidation
  -                        (((StandardHost) getParent()).getXmlValidation());
  -                }
  -
  -                if (!tldNamespaceAware){
  -                    tldConfig.setTldNamespaceAware
  -                        (((StandardHost) getParent()).getXmlNamespaceAware());
  -                }
  -                    
  -                try {
  -                    tldConfig.execute();
  -                } catch (Exception ex) {
  -                    log.error("Error reading tld listeners " 
  -                              + ex.toString(), ex);
  -                    //ok=false;
  -                }
  +                if(getProcessTlds() {
  +                 processTlds();
  +             }
   
                   // Notify our interested LifecycleListeners
                   lifecycle.fireLifecycleEvent(START_EVENT, null);
  @@ -4401,6 +4381,41 @@
   
           //cacheContext();
       }
  +
  +   /**
  +    * Processes the TLDs.
  +    *
  +    * @throws LifecycleException If an error occurs
  +    */
  +    protected void processTlds() throws LifecycleException {
  +      TldConfig tldConfig = new TldConfig();
  +      tldConfig.setContext(this);
  +
  +      // (1)  check if the attribute has been defined
  +      //      on the context element.
  +      tldConfig.setTldValidation(tldValidation);
  +      tldConfig.setTldNamespaceAware(tldNamespaceAware);
  +
  +      // (2) if the attribute wasn't defined on the context
  +      //     try the host.
  +      if (!tldValidation){
  +        tldConfig.setTldValidation
  +          (((StandardHost) getParent()).getXmlValidation());
  +      }
  +
  +      if (!tldNamespaceAware){
  +        tldConfig.setTldNamespaceAware
  +          (((StandardHost) getParent()).getXmlNamespaceAware());
  +      }
  +                    
  +      try {
  +        tldConfig.execute();
  +      } catch (Exception ex) {
  +        log.error("Error reading tld listeners " 
  +                  + ex.toString(), ex);
  +      }
  +    }
  +
       
       private void cacheContext() {
           try {
  @@ -5586,7 +5601,22 @@
       public boolean getTldValidation(){
           return tldValidation;
       }
  +   
  +    /**
  +     * Sets the processTlds attribute value.
  +     *
  +     * @param newProcessTlds The new attribute value
  +     */
  +    public void setProcessTlds(boolean newProcessTlds) {
  +     processTlds = newProcessTlds;
  +    }
   
  +    /**
  +     * Returns the processTlds attribute value.
  +     */
  +    public boolean getProcessTlds() {
  +     return processTlds;
  +    }
   
       /**
        * Get the server.xml <host> attribute's xmlNamespaceAware.
  
  
  
  No                   revision
  No                   revision
  1.70.2.22 +3 -0      jakarta-tomcat-catalina/webapps/docs/changelog.xml
  
  Index: changelog.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v
  retrieving revision 1.70.2.21
  retrieving revision 1.70.2.22
  diff -u -r1.70.2.21 -r1.70.2.22
  --- changelog.xml     31 Aug 2004 14:05:22 -0000      1.70.2.21
  +++ changelog.xml     31 Aug 2004 14:50:41 -0000      1.70.2.22
  @@ -42,6 +42,9 @@
         <fix>
           Added explicit close of randomIS DataInputStream to ManagerBase for better 
resource handling. (yoavs)
         </fix>
  +      <update>
  +        Added processTlds context attribute to allow disabling TLD processing. 
(yoavs)
  +      </update>
       </changelog>
     </subsection>
     <subsection name="Webapps">
  
  
  
  No                   revision
  No                   revision
  1.10.2.1  +23 -0     jakarta-tomcat-catalina/webapps/docs/config/context.xml
  
  Index: context.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/config/context.xml,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- context.xml       2 Jun 2004 12:43:34 -0000       1.10
  +++ context.xml       31 Aug 2004 14:50:41 -0000      1.10.2.1
  @@ -246,12 +246,35 @@
           </p>
         </attribute>
   
  +      <attribute name="processTlds" required="false">
  +        <p>Whether the context should process TLDs on startup.  The default
  +        is true.  The false setting is intended for special cases
  +        that know in advance TLDs are not part of the webapp.</p>
  +      </attribute>
  +
         <attribute name="swallowOutput" required="false">
           <p>If the value of this flag is <code>true</code>, the bytes output to
           System.out and System.err by the web application will be redirected to
           the web application logger. If not specified, the default value
           of the flag is <code>false</code>.</p>
         </attribute>
  +
  +      <attribute value="tldNamespaceAware" required="false">
  +        <p>If the value of this flag is <code>true</code>, the TLD files
  +        XML validation will be namespace-aware.  If you turn this flag on,
  +        you should probably also turn <code>tldValidation</code> on.  The
  +        default value for this flag is <code>false</code>, and setting it
  +        to true will incur a performance penalty.
  +        </p>
  +      </attribute>
  +
  +      <attribute value="tldValidation" required="false">
  +        <p>If the value of this flag is <code>true</code>, the TLD files
  +        will be XML validated on context startup.  The default value for
  +        this flag is <code>false</code>, and setting it to true will incur
  +        a performance penalty.</p>
  +      </attribute>
  +
   
         <attribute name="useNaming" required="false">
           <p>Set to <code>true</code> (the default) to have Catalina enable a
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to