remm 2003/03/07 02:53:47 Modified: webapps/docs jasper-howto.xml Log: - Add documentation on precompilation. Revision Changes Path 1.6 +109 -0 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- jasper-howto.xml 15 Jan 2003 03:40:43 -0000 1.5 +++ jasper-howto.xml 7 Mar 2003 10:53:47 -0000 1.6 @@ -171,6 +171,115 @@ </section> +<section name="Production Configuration"> + +<p>When using Jasper 2 in a production Tomcat server you should consider +making the following changes from the default configuration. +<ul> +<li><strong>development</strong> - To enable background compilation of JSP +pages set this to <code>false</code>.</li> +<li><strong>fork</strong> - The internal JVM javac compiler used by Ant +has a known memory leak. And Ant requires that java compiles be synchronized, +i.e. only one JSP page can be compiled at a time. Set fork to +<code>true</code> so that Ant compiles JSP pages in a seperate JVM. +This removes the synchronization of JSP page compiles and prevents +all the javac classes from being instantiated and subsequently garbage +collected by the JVM Tomcat is running in.</li> +</ul> +</p> + +</section> + +<section name="Web application precompilation"> + +<p>Using Ant is the preferred way to precompile web applications. +Use the script given below to precompile a webapp: +</p> + +<p> +<source> +<project name="Webapp Precompilation" default="all" basedir="."> + + <target name="jspc"> + + <taskdef classname="org.apache.jasper.JspC" name="jasper2" > + <classpath id="jspc.classpath"> + <pathelement location="${java.home}/../lib/tools.jar"/> + <fileset dir="${tomcat.home}/server/lib"> + <include name="*.jar"/> + </fileset> + <fileset dir="${tomcat.home}/common/lib"> + <include name="*.jar"/> + </fileset> + </classpath> + </taskdef> + + <jasper2 + compile="false" + validateXml="false" + uriroot="${webapp.path}" + webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml" + outputDir="${webapp.path}/WEB-INF/src" /> + + </target> + + <target name="compile"> + + <mkdir dir="${webapp.path}/WEB-INF/classes"/> + <mkdir dir="${webapp.path}/WEB-INF/lib"/> + + <javac destdir="${webapp.path}/WEB-INF/classes" + optimize="off" + debug="on" failonerror="false" + srcdir="${webapp.path}/WEB-INF/src" + excludes="**/*.smap"> + <classpath> + <pathelement location="${webapp.path}/WEB-INF/classes"/> + <fileset dir="${webapp.path}/WEB-INF/lib"> + <include name="*.jar"/> + </fileset> + <pathelement location="${tomcat.home}/common/classes"/> + <fileset dir="${tomcat.home}/common/lib"> + <include name="*.jar"/> + </fileset> + <pathelement location="${tomcat.home}/shared/classes"/> + <fileset dir="${tomcat.home}/shared/lib"> + <include name="*.jar"/> + </fileset> + </classpath> + <include name="**" /> + <exclude name="tags/**" /> + </javac> + + </target> + + <target name="all" depends="jspc,compile"> + </target> + +</project> +</source> +</p> + +<p> +The following command line can be used to run the script +(replacing the tokens with the Tomcat base path and the path to the webapp +which should be precompiled):<br/> +<source> +$ANT_HOME/ant.sh -Dtomcat.home=<$TOMCAT_HOME> -Dwebapp.path=<$WEBAPP_PATH> +</source> +</p> + +<p> +Then, the declarations and mappings for the servlets which were generated +during the precompilation must be added to the web application deployment +descriptor. Insert the <code>${webapp.path}/WEB-INF/generated_web.xml</code> +at the right place inside the <code>${webapp.path}/WEB-INF/web.xml</code> file. +Restart the web application (using the manager) and test it to verify it is +running fine with precompiled servlets. +</p> + +</section> + <section name="Using Jikes"> <p>If you wish to use
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]