From aeabaaab9071a1beae6729a10bc4b91b3aaf2542 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 21 May 2009 05:32:43 +0000 Subject: [PATCH] Refactor to put looking for jars into a method which can be overridden (eg by the jetty-maven-plugin, which does not have a WEB-INF/lib to look through, but must look through the classloader or the dependencies). git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@245 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../jetty/webapp/MetaInfConfiguration.java | 72 +++++++++++-------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java index 4b9a49608da..bdb117044ee 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java @@ -38,36 +38,13 @@ public class MetaInfConfiguration implements Configuration public static final String JARS_WITH_FRAGMENTS = "org.eclipse.jetty.webFragments"; public static final String JARS_WITH_RESOURCES = WebInfConfiguration.RESOURCE_URLS; + + public void preConfigure(final WebAppContext context) throws Exception { //Find all jars in WEB-INF - Resource web_inf = context.getWebInf(); - Resource web_inf_lib = web_inf.addPath("/lib"); - List urls = new ArrayList(); - - if (web_inf_lib.exists() && web_inf_lib.isDirectory()) - { - String[] files=web_inf_lib.list(); - for (int f=0;files!=null && f urls = findJars(context); + JarScanner fragScanner = new JarScanner() { public void processEntry(URL jarUrl, JarEntry entry) @@ -133,5 +110,44 @@ public class MetaInfConfiguration implements Configuration addJar(context,JARS_WITH_RESOURCES,jarUrl); } } - + + /** + * Look for jars in WEB-INF/lib + * @param context + * @return + * @throws Exception + */ + protected List findJars (WebAppContext context) + throws Exception + { + List urls = new ArrayList(); + + Resource web_inf = context.getWebInf(); + Resource web_inf_lib = web_inf.addPath("/lib"); + + + if (web_inf_lib.exists() && web_inf_lib.isDirectory()) + { + String[] files=web_inf_lib.list(); + for (int f=0;files!=null && f