tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MeadowBrook <meadowbr...@comcast.net>
Subject Deleting work files after JspRuntimeLibrary.include
Date Sun, 31 Jan 2010 17:21:04 GMT
I am running a system that uses a .jsp page to explicitly invoke the 
JspRuntimeLibrary.include 
<http://tomcat.apache.org/tomcat-4.1-doc/jasper/docs/api/org/apache/jasper/runtime/JspRuntimeLibrary.html#include%28javax.servlet.http.HttpServletRequest,%20javax.servlet.http.HttpServletResponse,%20java.lang.String,%20javax.servlet.jsp.JspWriter,%20boolean%29>

function to build another web page.

In the following, the full resulting page is stored as a string in 
HTMLString

try {
     myout = new StringWriter();
     pageContext.pushBody(myout);
     out = pageContext.getOut();
     
org.apache.jasper.runtime.JspRuntimeLibrary.include(request,response, 
compileFileName, out, true);
     pageContext.popBody();
     out = pageContext.getOut();
     HTMLString = myout.toString();
}
catch (Throwable t) {
     // == error processing
     HTMLString = "";
}
finally {
}

After the processing, I have no need of the original source file or the 
work files (the xxx_jsp.java and the xxx_jsp.class files) so I want to 
delete them.  I use the following to delete the work files:

//  the "source" jsp uses the sessionId to guarantee a unique name
//  insert the lead underscore if sessionId starts with a digit
String workFileName = compileWorkPath +
      (("0123456789".indexOf(sessionId.charAt(0))>-1)?"_":"")+
      sessionId+"_jsp";
if (!(new File(workFileName+".class").delete()) ||
     !(new File(workFileName+".java").delete()) )
{
    //  do appropriate error processing...
}

For both Tomcat5.5 and Tomcat6, the above successfully deletes the 
.class files, but not the .java files - with a file sharing exception.

It appears as if the .java files are still "open" somewhere in the 
Tomcat processing.  If I try to manually delete the .java file it also 
fails until I do another compile.   Once there is a new .java class in 
the work directory, then I can delete the prior one.

Any suggestions??  Is this a bug?

Thank you,

David Poor

PS:  If I have sent this to the wrong mailing list, please excuse the 
newbie error - and I would appreciate knowing which mailing list I 
should use.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message