Adds fetching resources from classpath
Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/5ed7b365 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/5ed7b365 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/5ed7b365 Branch: refs/heads/support-2-3 Commit: 5ed7b3656769fab4198e2eedf32eac1787e370b5 Parents: 2d70ea2 Author: Lukasz Lenart <[email protected]> Authored: Sun Dec 27 15:17:28 2015 +0100 Committer: Lukasz Lenart <[email protected]> Committed: Sun Dec 27 15:17:28 2015 +0100 ---------------------------------------------------------------------- .../StrutsWildcardServletTilesApplicationContext.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/5ed7b365/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsWildcardServletTilesApplicationContext.java ---------------------------------------------------------------------- diff --git a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsWildcardServletTilesApplicationContext.java b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsWildcardServletTilesApplicationContext.java index 8aa34fe..f01b45a 100644 --- a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsWildcardServletTilesApplicationContext.java +++ b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsWildcardServletTilesApplicationContext.java @@ -31,6 +31,7 @@ import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.util.Enumeration; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -46,6 +47,7 @@ public class StrutsWildcardServletTilesApplicationContext extends ServletTilesAp super(context); Set<URL> urls = new HashSet<URL>(); + for (Object path : context.getResourcePaths("/")) { try { URL url = new File(context.getRealPath(String.valueOf(path))).toURI().toURL(); @@ -55,6 +57,16 @@ public class StrutsWildcardServletTilesApplicationContext extends ServletTilesAp } } + try { + Enumeration<URL> resources = getClass().getClassLoader().getResources("/"); + while (resources.hasMoreElements()) { + URL resource = resources.nextElement(); + urls.add(resource); + } + } catch (IOException e) { + throw new ConfigurationException(e); + } + finder = new ResourceFinder(urls.toArray(new URL[urls.size()])); }
