remm        2004/10/04 10:39:46

  Modified:    jasper2/src/share/org/apache/jasper/resources
                        LocalStrings.properties
               jasper2/src/share/org/apache/jasper
                        EmbeddedServletOptions.java Options.java JspC.java
               jasper2/src/share/org/apache/jasper/compiler Compiler.java
               webapps/docs changelog.xml jasper-howto.xml
  Log:
  - Allow configuring the interval following a compilation during which a JSP will not 
be checked for modifications.
  
  Revision  Changes    Path
  1.2       +2 -1      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/LocalStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LocalStrings.properties   1 Sep 2004 10:08:48 -0000       1.1
  +++ LocalStrings.properties   4 Oct 2004 17:39:45 -0000       1.2
  @@ -143,6 +143,7 @@
   jsp.warning.sendErrToClient=Warning: Invalid value for the initParam 
sendErrToClient. Will use the default value of \"false\"
   jsp.warning.classDebugInfo=Warning: Invalid value for the initParam classdebuginfo. 
Will use the default value of \"false\"
   jsp.warning.checkInterval=Warning: Invalid value for the initParam checkInterval. 
Will use the default value of \"300\" seconds
  +jsp.warning.modificationTestInterval=Warning: Invalid value for the initParam 
modificationTestInterval. Will use the default value of \"4000\" milliseconds
   jsp.warning.development=Warning: Invalid value for the initParam development. Will 
use the default value of \"true\"
   jsp.warning.fork=Warning: Invalid value for the initParam fork. Will use the 
default value of \"true\"
   jsp.warning.reloading=Warning: Invalid value for the initParam reloading. Will use 
the default value of \"true\"
  
  
  
  1.14      +24 -4     
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbeddedServletOptions.java
  
  Index: EmbeddedServletOptions.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbeddedServletOptions.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- EmbeddedServletOptions.java       2 Sep 2004 16:05:06 -0000       1.13
  +++ EmbeddedServletOptions.java       4 Oct 2004 17:39:45 -0000       1.14
  @@ -164,7 +164,12 @@
        */
       private String javaEncoding = "UTF8";
   
  -    /*
  +    /**
  +     * Modification test interval.
  +     */
  +    public int modificationTestInterval = 4000;
  +    
  +    /**
        * Is generation of X-Powered-By response header enabled/disabled?
        */
       private boolean xpoweredBy;
  @@ -226,6 +231,13 @@
       }
   
       /**
  +     * Modification test interval.
  +     */
  +    public int getModificationTestInterval() {
  +        return modificationTestInterval;
  +    }
  +    
  +    /**
        * Is Jasper being used in development mode?
        */
       public boolean getDevelopment() {
  @@ -450,6 +462,17 @@
               }
           }
   
  +        String modificationTestInterval = 
config.getInitParameter("modificationTestInterval");
  +        if (modificationTestInterval != null) {
  +            try {
  +                this.modificationTestInterval = 
Integer.parseInt(modificationTestInterval);
  +            } catch(NumberFormatException ex) {
  +                if (log.isWarnEnabled()) {
  +                    
log.warn(Localizer.getMessage("jsp.warning.modificationTestInterval"));
  +                }
  +            }
  +        }
  +
           String development = config.getInitParameter("development");
           if (development != null) {
               if (development.equalsIgnoreCase("true")) {
  @@ -589,9 +612,6 @@
            }
           }
   
  -        /*
  -         * X-Powered-By
  -         */
           String xpoweredBy = config.getInitParameter("xpoweredBy"); 
           if (xpoweredBy != null) {
               if (xpoweredBy.equalsIgnoreCase("true")) {
  
  
  
  1.25      +6 -0      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java
  
  Index: Options.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Options.java      2 Sep 2004 16:05:06 -0000       1.24
  +++ Options.java      4 Oct 2004 17:39:45 -0000       1.25
  @@ -164,4 +164,10 @@
        * Are Text strings to be generated as char arrays?
        */
       public boolean genStringAsCharArray();
  +    
  +    /**
  +     * Modification test interval.
  +     */
  +    public int getModificationTestInterval();
  +    
   }
  
  
  
  1.83      +7 -0      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java
  
  Index: JspC.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- JspC.java 3 Oct 2004 09:03:21 -0000       1.82
  +++ JspC.java 4 Oct 2004 17:39:45 -0000       1.83
  @@ -373,6 +373,13 @@
       }
   
       /**
  +     * Modification test interval.
  +     */
  +    public int getModificationTestInterval() {
  +        return 4000;
  +    }
  +
  +    /**
        * Is Jasper being used in development mode?
        */
       public boolean getDevelopment() {
  
  
  
  1.93      +2 -1      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- Compiler.java     16 Aug 2004 23:48:35 -0000      1.92
  +++ Compiler.java     4 Oct 2004 17:39:46 -0000       1.93
  @@ -321,7 +321,8 @@
           boolean outDated = false;
           String jsp = ctxt.getJspFile();
   
  -        if ((jsw != null) && ((jsw.getLastModificationTest() + 2000) 
  +        if ((jsw != null) && ((jsw.getLastModificationTest() 
  +                + ctxt.getOptions().getModificationTestInterval()) 
               > System.currentTimeMillis())) {
               return false;
           }
  
  
  
  1.128     +4 -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.127
  retrieving revision 1.128
  diff -u -r1.127 -r1.128
  --- changelog.xml     4 Oct 2004 15:23:59 -0000       1.127
  +++ changelog.xml     4 Oct 2004 17:39:46 -0000       1.128
  @@ -179,6 +179,10 @@
         <fix>
           Fix cosmetic issue where extra CRLF would be inserted during each 
precompilation in web.xml. (remm)
         </fix>
  +      <update>
  +        Allow configuring the interval following a compilation during which a JSP 
will not be checked
  +        for modifications. (remm)
  +      </update>
       </changelog>
     </subsection>
   
  
  
  
  1.17      +26 -1     jakarta-tomcat-catalina/webapps/docs/jasper-howto.xml
  
  Index: jasper-howto.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/jasper-howto.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- jasper-howto.xml  18 Sep 2004 17:09:31 -0000      1.16
  +++ jasper-howto.xml  4 Oct 2004 17:39:46 -0000       1.17
  @@ -117,6 +117,11 @@
   print statement per input line, to ease debugging?
   <code>true</code> or <code>false</code>, default <code>true</code>.</li>
   
  +<li><strong>modificationTestInterval</strong> - Checks for modification for a given
  +JSP file (and all its dependent files) will be performed only once every specified 
amount
  +of milliseconds. Setting this to -1 will cause the JSP to be checked on every 
access.
  +Default is <code>4000</code> milliseconds.</li>
  +
   <li><strong>reloading</strong> - Should Jasper check for modified JSPs?
   <code>true</code> or <code>false</code>, default <code>false</code>.</li>
   
  @@ -129,10 +134,26 @@
   </ul>
   </p>
   
  +<p>The Java compiler from Eclipse JDT in included as the default compiler. It is an
  +advanced Java compiler which will load all dependencies from the Tomcat class 
loader, 
  +which will help tremendously when compiling on large installations with tens of 
JARs.
  +On fast servers, this will allow sub-second recompilation cycles for even large JSP 
  +pages. This new compiler will be updated to support the Java 5 syntax as soon as
  +possible.</p>
  +
  +<p>Apache Ant, which was used in previous Tomcat releases, can be used instead 
instead of 
  +the new compiler by simply removing the 
<code>common/lib/jasper-compiler-jdt.jar</code> file, 
  +and placing the <code>ant.jar</code> file from the latest Ant distribution in the 
  +<code>common/lib</code> folder.</p>
  +
   </section>
   
   <section name="Production Configuration">
   
  +<p>The main JSP optimization which can be done is precompilation of JSPs. However,
  +this might not be possible (for example, when using the jsp-property-group feature)
  +or practical, in which case the configuration of the Jasper servlet becomes 
critical.</p>
  +
   <p>When using Jasper 2 in a production Tomcat server you should consider
   making the following changes from the default configuration.
   <ul>
  @@ -140,6 +161,9 @@
   pages compilation set this to <code>false</code>.</li>
   <li><strong>genStrAsCharArray</strong> - To generate slightly more efficient 
   char arrays, set this to <code>true</code>.</li>
  +<li><strong>modificationTestInterval</strong> - If development has to be set to
  +<code>true</code> for any reason (such as dynamic generation of JSPs), setting
  +this to a high value will improve performance a lot.</li>
   <li><strong>trimSpaces</strong> - To remove useless bytes from the response,
   set this to <code>true</code>.</li>
   </ul>
  @@ -150,7 +174,8 @@
   <section name="Web Application Compilation">
   
   <p>Using Ant is the preferred way to compile web applications using JSPC. 
  -Use the script given below to precompile a webapp:
  +Use the script given below (a similar script is included in the "deployer" 
  +download) to precompile a webapp:
   </p>
   
   <p>
  
  
  

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

Reply via email to