![]() | ![]() | ![]() | ||||||||||||||||||||||||||
![]() | ||||||||||||||||||||||||||||
documentation examples changes overview quick start installation command-line configuration admin amber clustering caching database deployment ejb 3.0 embedding filters hessian hmtp ioc jsp logging messaging performance quercus/php remoting scheduled tasks security server push servlets third-party troubleshooting virtual hosting watchdog webapp xml and xslt introduction compilation el jstl directives variables actions applications schema for jsp-2.0 .tld files velocity syntax jsp templates | jsp compilation
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 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 to apply to all web-app's. resin.conf <web-app-default> <listener> <listener-class>com.caucho.jsp.JspPrecompileListener</listener-class> <init> <extension>jsp</extension> <extension>jspx</extension> <extension>xtp</extension> </init> </listener> </web-app-default> You can also use a fileset for more control over which jsp are precompiled: resin.conf <web-app> <listener> <listener-class>com.caucho.jsp.JspPrecompileListener</listener-class> <init> <fileset> <include>**/*.jsp</include> <exclude>/a.jsp</exclude> <exclude>/foo/c.jsp</exclude> </fileset> </init> </listener> </web-app>
The first line includes all jsp's, it's the same as specifying
com.caucho.jsp.JspCompiler is used to compile JSP.
Command line usage of JspCompileCommand line usage accepts arguments that correspond to the parameters
available to the parameters of the 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 xml configuration file: compile-app.xml <web-app xmlns="http://caucho.com/ns/resin"> <app-dir>/opt/www/webapps/foo</app-dir> <xml>true</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
|