Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project

This commit is contained in:
Simone Bordet 2012-03-28 11:41:36 +02:00
commit ec5f424c8c
1 changed files with 33 additions and 41 deletions

View File

@ -402,8 +402,7 @@ public class WebInfConfiguration extends AbstractConfiguration
} }
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
LOG.debug("Try webapp=" + web_app + ", exists=" + web_app.exists() + ", directory=" + web_app.isDirectory()); LOG.debug("Try webapp=" + web_app + ", exists=" + web_app.exists() + ", directory=" + web_app.isDirectory()+" file="+(web_app.getFile()));
// Is the WAR usable directly? // Is the WAR usable directly?
if (web_app.exists() && !web_app.isDirectory() && !web_app.toString().startsWith("jar:")) if (web_app.exists() && !web_app.isDirectory() && !web_app.toString().startsWith("jar:"))
{ {
@ -485,57 +484,50 @@ public class WebInfConfiguration extends AbstractConfiguration
LOG.debug("webapp=" + web_app); LOG.debug("webapp=" + web_app);
} }
// Do we need to extract WEB-INF/lib? // Do we need to extract WEB-INF/lib?
if (context.isCopyWebInf()) if (context.isCopyWebInf() && !context.isCopyWebDir())
{ {
Resource web_inf= web_app.addPath("WEB-INF/"); Resource web_inf= web_app.addPath("WEB-INF/");
if (web_inf instanceof ResourceCollection || File extractedWebInfDir= new File(context.getTempDirectory(), "webinf");
web_inf.exists() && if (extractedWebInfDir.exists())
web_inf.isDirectory() && IO.delete(extractedWebInfDir);
(web_inf.getFile()==null || !web_inf.getFile().isDirectory())) extractedWebInfDir.mkdir();
{ Resource web_inf_lib = web_inf.addPath("lib/");
File extractedWebInfDir= new File(context.getTempDirectory(), "webinf"); File webInfDir=new File(extractedWebInfDir,"WEB-INF");
if (extractedWebInfDir.exists()) webInfDir.mkdir();
IO.delete(extractedWebInfDir);
extractedWebInfDir.mkdir();
Resource web_inf_lib = web_inf.addPath("lib/");
File webInfDir=new File(extractedWebInfDir,"WEB-INF");
webInfDir.mkdir();
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()) if (webInfLibDir.exists())
IO.delete(webInfLibDir); 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);
web_inf_lib.copyTo(webInfLibDir); web_inf_lib.copyTo(webInfLibDir);
} }
Resource web_inf_classes = web_inf.addPath("classes/"); Resource web_inf_classes = web_inf.addPath("classes/");
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()) if (webInfClassesDir.exists())
IO.delete(webInfClassesDir); 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);
} }
web_inf=Resource.newResource(extractedWebInfDir.getCanonicalPath()); web_inf=Resource.newResource(extractedWebInfDir.getCanonicalPath());
ResourceCollection rc = new ResourceCollection(web_inf,web_app); ResourceCollection rc = new ResourceCollection(web_inf,web_app);
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
LOG.debug("context.resourcebase = "+rc); LOG.debug("context.resourcebase = "+rc);
context.setBaseResource(rc); context.setBaseResource(rc);
}
} }
} }