Search This Blog

Thursday 24 January 2008

Precompiling JSP's within an EAR file using OJSPC

You can precompile JSP files to avoid the hassle of compiling the JSP on it's first request into a servlet class file at runtime prior to deployment using "ojspc". The key is how to check that it has indeed done that. His an example:

Step 1: verify EAR file
- jar -tvf jspcompile.ear
       487 Thu Jan 24 11:26:22 EST 2008 META-INF/application.xml
226 Thu Jan 24 11:26:12 EST 2008 META-INF/orion-application.xml
2066 Thu Jan 24 11:26:22 EST 2008 jspcompile.war
Step 2: Compile using ojspc
- ojspc jspcompile.ear
    Detected archive, now processing contents of jspcompile.ear...
Setting up temp area...
Expanding archive in temp area...
Detected archive, now processing contents of /tmp/tmp56123/jspcompile.war...
Setting up temp area...
Expanding archive in temp area...
Creating /tmp/tmp56123/jspcompile.war ...
Removing temp area...
Creating /u01/pas/tars/sr/jspcompile.ear ...

Removing temp area...
Step 3: Verify compiled JSP JAR file is present within WEB-INF\lib

Extract EAR file
jar -xvf jspcompile.ear
     inflated: META-INF/application.xml
inflated: META-INF/orion-application.xml
inflated: jspcompile.war
Extract WAR File
jar -xvf jspcompile.war
     inflated: Page1.jsp
inflated: Page2.jsp
inflated: WEB-INF/classes/META-INF/orion-application.xml
inflated: WEB-INF/web.xml
inflated: WEB-INF/lib/__oracle_jsp_jspcompile.jar

As you can see OJSPC has created a file called "__oracle_jsp_jspcompile.jar" with the precompiled JSP source files ready to be run. More info on this is in the online documentation for OAS 10.1.3.x

http://download.oracle.com/docs/cd/B31017_01/web.1013/b28961/ojspc.htm#sthref209
Precompiling JSPs within a WAR File

No comments: