precompiling JSPs -- how to resolve references normally resolved by apache?
Hi, I am trying to get our JSPs to be precompiled as part of our ant build process to catch all syntax errors at compile time. The problem I have run into is that we are using apache + tomcat and we have set the following rules in apache httpd. conf: JkMount /servlets/* ajp13 JkMount /jsp/* ajp13 JkMount /controller/* cont JkMount /cgi-bin/java-rmi.cgi ajp13 Inside some of our servlets and JSPs, they refer to other jsps using the absolute URL "/jsp/" which works in deployed environment because apache redirects it. For example, in one JSP we have <%@ include file="/jsp/Header.jsp" %> I setup the tomcat-4.1.30 ant jspc task and it was giving a NPE. Then I tried the Ant Jspc optional task, and it gave me an error message: the file '\Status.jsp' generated the following general exceptionn: org.apache.jasper.JasperExeption: /Status.jsp(3,0) File "/jsp/Header.jsp" not found Is there any quick and dirty way to get the JspC to resolve the "/jsp/*.jsp" urls to "*.jsp" or is there no way? My alternative is to try to change all the "/jsp/*.jsp" references to "*.jsp" everywhere we do an <%@ include %> or or . I think that would be ok since those directices are handled on the tomcat side. Changing it would be kind of messy since we have a ton of JSPs in a large directory hierarchy, so some of those "/jsp/Header.jsp" references would have to be changed to "../../Header.jsp", etc. I know I can't get away from the "/jsp" mapping completely because we have URLs and HTTP redirects which depend on it. Here is the quick and dirty jspc ant target I created: Thanks for any advice, -Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: precompiling JSPs -- how to resolve references normally resolved by apache?
Unless you have a directory ${TOP}/web/html/jsp/jsp your uribase/uriroot probably aren't right. [EMAIL PROTECTED] wrote: Hi, I am trying to get our JSPs to be precompiled as part of our ant build process to catch all syntax errors at compile time. The problem I have run into is that we are using apache + tomcat and we have set the following rules in apache httpd. conf: JkMount /servlets/* ajp13 JkMount /jsp/* ajp13 JkMount /controller/* cont JkMount /cgi-bin/java-rmi.cgi ajp13 Inside some of our servlets and JSPs, they refer to other jsps using the absolute URL "/jsp/" which works in deployed environment because apache redirects it. For example, in one JSP we have <%@ include file="/jsp/Header.jsp" %> I setup the tomcat-4.1.30 ant jspc task and it was giving a NPE. Then I tried the Ant Jspc optional task, and it gave me an error message: the file '\Status.jsp' generated the following general exceptionn: org.apache.jasper.JasperExeption: /Status.jsp(3,0) File "/jsp/Header.jsp" not found Is there any quick and dirty way to get the JspC to resolve the "/jsp/*.jsp" urls to "*.jsp" or is there no way? My alternative is to try to change all the "/jsp/*.jsp" references to "*.jsp" everywhere we do an <%@ include %> or or . I think that would be ok since those directices are handled on the tomcat side. Changing it would be kind of messy since we have a ton of JSPs in a large directory hierarchy, so some of those "/jsp/Header.jsp" references would have to be changed to "../../Header.jsp", etc. I know I can't get away from the "/jsp" mapping completely because we have URLs and HTTP redirects which depend on it. Here is the quick and dirty jspc ant target I created: Thanks for any advice, -Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: precompiling JSPs -- how to resolve references normally resolved by apache?
Jon, Thanks for your help. The uribase and uriroot were not set correctly. Here is the final version that I got working. I had one additional twist that I needed to copy the JSP files to another location first using the ant task. I set uriroot to the webapps root {dir}/html, and then jasper2 automatically found the JSP files in the subdirectories under jsp/** and correctly resolved the references "/jsp/**.jsp" inside the JSP files. Once it works, it's great. But it several hours of frustration because tomcat4.x jasper often just print NullPointerExceptions instead of an error message. So you have to guess what is wrong. -Alex On Thu, 06 Oct 2005 14:06:23 +0100, "Jon Wingfield" <[EMAIL PROTECTED]> said: > > > Unless you have a directory ${TOP}/web/html/jsp/jsp your uribase/uriroot > probably aren't right. > > [EMAIL PROTECTED] wrote: > > Hi, > > > > I am trying to get our JSPs to be precompiled as part of > > our ant build process to catch all syntax errors at compile > > time. > > > > The problem I have run into is that we are using apache + > > tomcat and we have set the following rules in apache httpd. > > conf: > > > >JkMount /servlets/* ajp13 > >JkMount /jsp/* ajp13 > >JkMount /controller/* cont > >JkMount /cgi-bin/java-rmi.cgi ajp13 > > > > Inside some of our servlets and JSPs, they refer to other > > jsps using the absolute URL "/jsp/" which works in deployed > > environment because apache redirects it. For example, in > > one JSP we have <%@ include file="/jsp/Header.jsp" %> > > > > I setup the tomcat-4.1.30 ant jspc task and it was giving a > > NPE. Then I tried the Ant Jspc optional task, and it gave > > me an error message: > > > > the file '\Status.jsp' generated the following general > > exceptionn: org.apache.jasper.JasperExeption: > > /Status.jsp(3,0) File "/jsp/Header.jsp" not found > > > > Is there any quick and dirty way to get the JspC to resolve > > the "/jsp/*.jsp" urls to "*.jsp" or is there no way? > > > > My alternative is to try to change all the "/jsp/*.jsp" > > references to "*.jsp" everywhere we do an <%@ include %> or > > or . I think that would be ok > > since those directices are handled on the tomcat side. Changing > > it would be kind of messy since we have a ton of JSPs in a > > large directory hierarchy, so some of those "/jsp/Header.jsp" > > references would have to be changed to "../../Header.jsp", etc. > > I know I can't get away from the "/jsp" mapping completely > > because we have URLs and HTTP redirects which depend on it. > > > > Here is the quick and dirty jspc ant target I created: > > > srcdir="${TOP}/web/html/jsp" > > uribase="${TOP}/web/html/jsp" > > uriroot="${TOP}/web/html/jsp" > > destdir="${TMP_DIR}/WEB-INF/src" > > compiler="jasper41" > > verbose="9"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks for any advice, > > -Alex > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]