374881 Ensure setCopyWebInf(true) only copies WEB-INF if !setCopyWebDir(true)
This commit is contained in:
parent
22f437c36d
commit
ef0d6d32f9
|
@ -402,8 +402,7 @@ public class WebInfConfiguration extends AbstractConfiguration
|
|||
}
|
||||
|
||||
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?
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Do we need to extract WEB-INF/lib?
|
||||
if (context.isCopyWebInf())
|
||||
if (context.isCopyWebInf() && !context.isCopyWebDir())
|
||||
{
|
||||
Resource web_inf= web_app.addPath("WEB-INF/");
|
||||
|
||||
if (web_inf instanceof ResourceCollection ||
|
||||
web_inf.exists() &&
|
||||
web_inf.isDirectory() &&
|
||||
(web_inf.getFile()==null || !web_inf.getFile().isDirectory()))
|
||||
{
|
||||
File extractedWebInfDir= new File(context.getTempDirectory(), "webinf");
|
||||
if (extractedWebInfDir.exists())
|
||||
IO.delete(extractedWebInfDir);
|
||||
extractedWebInfDir.mkdir();
|
||||
Resource web_inf_lib = web_inf.addPath("lib/");
|
||||
File webInfDir=new File(extractedWebInfDir,"WEB-INF");
|
||||
webInfDir.mkdir();
|
||||
File extractedWebInfDir= new File(context.getTempDirectory(), "webinf");
|
||||
if (extractedWebInfDir.exists())
|
||||
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())
|
||||
{
|
||||
File webInfLibDir = new File(webInfDir, "lib");
|
||||
if (webInfLibDir.exists())
|
||||
IO.delete(webInfLibDir);
|
||||
webInfLibDir.mkdir();
|
||||
if (web_inf_lib.exists())
|
||||
{
|
||||
File webInfLibDir = new File(webInfDir, "lib");
|
||||
if (webInfLibDir.exists())
|
||||
IO.delete(webInfLibDir);
|
||||
webInfLibDir.mkdir();
|
||||
|
||||
LOG.info("Copying WEB-INF/lib " + web_inf_lib + " to " + webInfLibDir);
|
||||
web_inf_lib.copyTo(webInfLibDir);
|
||||
}
|
||||
LOG.info("Copying WEB-INF/lib " + web_inf_lib + " to " + webInfLibDir);
|
||||
web_inf_lib.copyTo(webInfLibDir);
|
||||
}
|
||||
|
||||
Resource web_inf_classes = web_inf.addPath("classes/");
|
||||
if (web_inf_classes.exists())
|
||||
{
|
||||
File webInfClassesDir = new File(webInfDir, "classes");
|
||||
if (webInfClassesDir.exists())
|
||||
IO.delete(webInfClassesDir);
|
||||
webInfClassesDir.mkdir();
|
||||
LOG.info("Copying WEB-INF/classes from "+web_inf_classes+" to "+webInfClassesDir.getAbsolutePath());
|
||||
web_inf_classes.copyTo(webInfClassesDir);
|
||||
}
|
||||
Resource web_inf_classes = web_inf.addPath("classes/");
|
||||
if (web_inf_classes.exists())
|
||||
{
|
||||
File webInfClassesDir = new File(webInfDir, "classes");
|
||||
if (webInfClassesDir.exists())
|
||||
IO.delete(webInfClassesDir);
|
||||
webInfClassesDir.mkdir();
|
||||
LOG.info("Copying WEB-INF/classes from "+web_inf_classes+" to "+webInfClassesDir.getAbsolutePath());
|
||||
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())
|
||||
LOG.debug("context.resourcebase = "+rc);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("context.resourcebase = "+rc);
|
||||
|
||||
context.setBaseResource(rc);
|
||||
}
|
||||
context.setBaseResource(rc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue