From ec3a5b4f6106b8f610d02b88f0fb37a0d09d3a2c Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 15 Feb 2010 02:40:28 +0000 Subject: [PATCH] 302669 git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1266 7e9141cc-0065-0410-87d8-b60c137991c4 --- VERSION.txt | 1 + .../jetty/webapp/WebInfConfiguration.java | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index c40ac21a2c6..42f6896aad3 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -26,6 +26,7 @@ jetty-7.0.2-SNAPSHOT + 300933 AbstractConnector uses concurrent objects for stats + 301089 Improve statistics available in StatisticsHandler and AbstractConnector + 302556 CrossOriginFilter does not work correctly when Access-Control-Request-Headers header is not present + + 302669 WebInfConfiguration.unpack() unpacks WEB-INF/* from a ResourceCollection, breaking JSP reloading with ResourceCollections jetty-7.0.1.v20091125 25 November 2009 + 274251 DefaultServlet supports exact match mode. diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java index 8a0b838f4c6..a7aaff85a01 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java @@ -453,6 +453,7 @@ public class WebInfConfiguration implements Configuration throw new java.io.FileNotFoundException(war); } + context.setBaseResource(web_app); if (Log.isDebugEnabled()) @@ -463,6 +464,7 @@ public class WebInfConfiguration implements Configuration // Do we need to extract WEB-INF/lib? Resource web_inf= web_app.addPath("WEB-INF/"); + if (web_inf instanceof ResourceCollection || web_inf.exists() && web_inf.isDirectory() && @@ -472,12 +474,35 @@ public class WebInfConfiguration implements Configuration if (extractedWebInfDir.exists()) extractedWebInfDir.delete(); extractedWebInfDir.mkdir(); + Resource web_inf_lib = web_inf.addPath("lib/"); File webInfDir=new File(extractedWebInfDir,"WEB-INF"); webInfDir.mkdir(); - Log.info("Extract " + web_inf + " to " + webInfDir); - web_inf.copyTo(webInfDir); + + if (web_inf_lib.exists()) + { + File webInfLibDir = new File(webInfDir, "lib"); + webInfLibDir.mkdir(); + + 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"); + 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.toURL()); + ResourceCollection rc = new ResourceCollection(new Resource[]{web_inf,web_app}); + + if (Log.isDebugEnabled()) + Log.debug("context.resourcebase = "+rc); + context.setBaseResource(rc); } }