tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <>
Subject Re: Jasper, JSPC, Ant and Precompiling JSP's
Date Mon, 04 Aug 2003 15:52:04 GMT
Thanks Ian,

We actually already have a shell script that does this too. I was hoping 
to get some details on how to make the jspc and tomcat behaviors more 
consistent with each other so that I could move away from this strategy 
and use the compiler directly.

Unfortunately, its often the case that our jsp's are behind security 
realms and cannot be gotten at without logging into the webapplication 
first which means we need to maintain session information while 
'grazing' the jsp's.

Since this was starting to get more complex than I wanted, I was hoping 
to step back and see why JspC wasn't just providing jsp compilation 
features that were not consistent with Tomcats behavior when compiling 
intothe work directory.

 From what I understand, Jasper loads each JSP into its own classloader, 
this means that it can get away with having the same exact package name 
in each JSP even though they are in different directories in 'work' the 
classloaders load each individual file relative to 
to the directory it is within.

JspC on the other had, treats the directory as a package hierarchy 
(which is great if your going to dump them into the classes directory 
and map them in your web.xml). It is apparent that JspC cannot be used 
to compile the JSP's into Tomcats work directory because of this package 
naming issue.


Zabel, Ian wrote:
> Mark,
>  >I want my JSP's to get precompiled into the work directory of Tomcat 
> and used from there,
>  >the exact same way that Tomcat does it. This way afterward, if the jsp 
> is modified, tomcat can still recompile it.
> I have a class that you can use as part of a build or manually that will 
> trigger tomcat to compile all the jsps, given a directory and a URL. It 
> can easily be converted into an Ant task.
> I'll send you the source if you want. Basically, it reads in a 
> directory, filters to find all the jsp names in it, and then iterates 
> through them, and calls 
> http://tomcatserver/path/jspname.jsp?jsp_precompile=true
> The jsp_precompile=true is understood by tomcat to mean: just compile 
> the jsp, don't do anything else.
> This process effectively compiles every single jsp in your webapp, but 
> must be done on a live tomcat server, not offline. You could then copy 
> all of the generated jsp java classes from the work directory into a 
> production tomcat server, and hopefully it would use them instead of 
> recompiling.
> Let me know if you want it.
> Ian.

View raw message