JSP compilation causes the compilation of JSP files before they are first
accessed on a live server.
Unless explicitly compiled ahead of time, JSP files are compiled the first
time they are accessed. On large production sites, or in situations involving
complicated JSP files, compilation may cause unacceptable delays to users first
accessing the JSP page.
Resin provides a JspCompiler that is used to explicitly compile
jsp files before they are accessed for the first time.
class com.caucho.jsp.JspCompiler is used to compile JSP.
Parameter | Meaning | default |
class-dir | the destination class directory | the system work path
|
app-dir | the root directory of an application to compile | required
|
xml | if true then XML is the default parser | false
|
prelude | add a prelude include | none
|
coda | add a coda include | none
|
tag | classname specifying a tag to compile | none
|
Command line usage accepts arguments that correspond to the parameters
available to the parameters of the JSpCompiler class.
command line
unix> java com.caucho.jsp.JspCompiler -app-dir "/opt/www/foo" test/foo.jsp
|
com.caucho.jsp.JspCompiler accepts a -conf argument, which
points to a web-app configuration.
compile-app.xml
<web-app xmlns="http://caucho.com/ns/resin">
<document-directory>/opt/www/foo</document-directory>
<resin:import path="/opt/resin/conf/app-default.xml"/>
</web-app>
|
command line with compile-app.xml conf file
unix> java com.caucho.jsp.JspCompiler -conf /opt/resin/compile-app.xml" test/foo.jsp
|
class com.caucho.jsp.JspPrecompileListener is a ServletContextListener
that compiles jsp files when the web-app starts. It is activated using the
<listener> Servlet configuration tag in web.xml.
The following configuration causes Resin to compile all files in the web-app
that have an extension of .jsp or .jspx when the application first starts.
WEB-INF/web.xml
<web-app xmlns="http://caucho.com/ns/resin">
<listener>
<listener-class>com.caucho.jsp.JspPrecompileListener</listener-class>
<init>
<extension>jsp</extension>
<extension>jspx</extension>
</init>
</listener>
</web-app>
|
It can also be configured in resin.conf.
resin.conf
<web-app id="foo" document-directory="/usr/local/webapps/foo">
<listener>
<listener-class>com.caucho.jsp.JspPrecompileListener</listener-class>
<init>
<extension>jsp</extension>
<extension>jspx</extension>
<extension>xtp</extension>
</init>
</listener>
</web-app>
|
Copyright © 1998-2005 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. | |
|