325468 Clean work webapp dir before unpack

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2284 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-09-16 22:31:16 +00:00
parent 62df1762d2
commit 7fb5d15d13
2 changed files with 12 additions and 6 deletions

View File

@ -34,6 +34,7 @@ jetty-7.2-SNAPSHOT
+ 325072 include to DefaultServlet of missing file throws FileNotFoundException + 325072 include to DefaultServlet of missing file throws FileNotFoundException
+ 325105 websocket ondisconnect fixed + 325105 websocket ondisconnect fixed
+ 325128 websocket send during onConnect + 325128 websocket send during onConnect
+ 325468 Clean work webapp dir before unpack
+ JETTY-912 added per exchange timeout api + JETTY-912 added per exchange timeout api
+ JETTY-1245 Do not use direct buffers with NIO SSL + JETTY-1245 Do not use direct buffers with NIO SSL
+ JETTY-1249 Apply max idle time to all connectors + JETTY-1249 Apply max idle time to all connectors

View File

@ -174,7 +174,9 @@ public class WebInfConfiguration extends AbstractConfiguration
{ {
File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile()); File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile());
if (tmpDir.exists()) if (tmpDir.exists())
tmpDir.delete(); {
IO.delete(tmpDir);
}
tmpDir.mkdir(); tmpDir.mkdir();
tmpDir.deleteOnExit(); tmpDir.deleteOnExit();
context.setTempDirectory(tmpDir); context.setTempDirectory(tmpDir);
@ -279,7 +281,7 @@ public class WebInfConfiguration extends AbstractConfiguration
// Last resort // Last resort
tmpDir=File.createTempFile("JettyContext",""); tmpDir=File.createTempFile("JettyContext","");
if (tmpDir.exists()) if (tmpDir.exists())
tmpDir.delete(); IO.delete(tmpDir);
tmpDir.mkdir(); tmpDir.mkdir();
tmpDir.deleteOnExit(); tmpDir.deleteOnExit();
context.setTempDirectory(tmpDir); context.setTempDirectory(tmpDir);
@ -337,7 +339,7 @@ public class WebInfConfiguration extends AbstractConfiguration
String old=tmpDir.toString(); String old=tmpDir.toString();
tmpDir=File.createTempFile(temp+"_",""); tmpDir=File.createTempFile(temp+"_","");
if (tmpDir.exists()) if (tmpDir.exists())
tmpDir.delete(); IO.delete(tmpDir);
Log.warn("Can't reuse "+old+", using "+tmpDir); Log.warn("Can't reuse "+old+", using "+tmpDir);
} }
} }
@ -442,7 +444,7 @@ public class WebInfConfiguration extends AbstractConfiguration
//only extract if the war file is newer //only extract if the war file is newer
if (web_app.lastModified() > extractedWebAppDir.lastModified()) if (web_app.lastModified() > extractedWebAppDir.lastModified())
{ {
extractedWebAppDir.delete(); IO.delete(extractedWebAppDir);
extractedWebAppDir.mkdir(); extractedWebAppDir.mkdir();
Log.info("Extract " + web_app + " to " + extractedWebAppDir); Log.info("Extract " + web_app + " to " + extractedWebAppDir);
Resource jar_web_app = JarResource.newJarResource(web_app); Resource jar_web_app = JarResource.newJarResource(web_app);
@ -460,7 +462,6 @@ public class WebInfConfiguration extends AbstractConfiguration
throw new java.io.FileNotFoundException(war); throw new java.io.FileNotFoundException(war);
} }
context.setBaseResource(web_app); context.setBaseResource(web_app);
if (Log.isDebugEnabled()) if (Log.isDebugEnabled())
@ -479,7 +480,7 @@ public class WebInfConfiguration extends AbstractConfiguration
{ {
File extractedWebInfDir= new File(context.getTempDirectory(), "webinf"); File extractedWebInfDir= new File(context.getTempDirectory(), "webinf");
if (extractedWebInfDir.exists()) if (extractedWebInfDir.exists())
extractedWebInfDir.delete(); IO.delete(extractedWebInfDir);
extractedWebInfDir.mkdir(); extractedWebInfDir.mkdir();
Resource web_inf_lib = web_inf.addPath("lib/"); Resource web_inf_lib = web_inf.addPath("lib/");
File webInfDir=new File(extractedWebInfDir,"WEB-INF"); File webInfDir=new File(extractedWebInfDir,"WEB-INF");
@ -488,6 +489,8 @@ public class WebInfConfiguration extends AbstractConfiguration
if (web_inf_lib.exists()) if (web_inf_lib.exists())
{ {
File webInfLibDir = new File(webInfDir, "lib"); File webInfLibDir = new File(webInfDir, "lib");
if (webInfLibDir.exists())
IO.delete(webInfLibDir);
webInfLibDir.mkdir(); webInfLibDir.mkdir();
Log.info("Copying WEB-INF/lib " + web_inf_lib + " to " + webInfLibDir); Log.info("Copying WEB-INF/lib " + web_inf_lib + " to " + webInfLibDir);
@ -498,6 +501,8 @@ public class WebInfConfiguration extends AbstractConfiguration
if (web_inf_classes.exists()) if (web_inf_classes.exists())
{ {
File webInfClassesDir = new File(webInfDir, "classes"); File webInfClassesDir = new File(webInfDir, "classes");
if (webInfClassesDir.exists())
IO.delete(webInfClassesDir);
webInfClassesDir.mkdir(); webInfClassesDir.mkdir();
Log.info("Copying WEB-INF/classes from "+web_inf_classes+" to "+webInfClassesDir.getAbsolutePath()); Log.info("Copying WEB-INF/classes from "+web_inf_classes+" to "+webInfClassesDir.getAbsolutePath());
web_inf_classes.copyTo(webInfClassesDir); web_inf_classes.copyTo(webInfClassesDir);