ClassLoader webAppClassLoader = Thread.currentThread().getContextClassLoader(); UrlSet urlSet = new UrlSet(webAppClassLoader); urlSet = urlSet.exclude(webAppClassLoader.getParent()); urlSet = urlSet.matching(".*acme-.*.jar"); List<URL> urls = urlSet.getUrls();
public UrlSet excludePaths(String pathString) throws MalformedURLException { String[] paths = pathString.split(File.pathSeparator); UrlSet urlSet = this; for (String path : paths) { if (StringUtils.isNotEmpty(path)) { File file = new File(path); urlSet = urlSet.exclude(file); } } return urlSet; }
public UrlSet excludeJavaHome() throws MalformedURLException { String path = System.getProperty("java.home"); if (path != null) { File java = new File(path); if (path.matches("/System/Library/Frameworks/JavaVM.framework/Versions/[^/]+/Home")){ java = java.getParentFile(); } return exclude(java); } else { return this; } }
public UrlSet exclude(File file) throws MalformedURLException { return exclude(relative(file)); }
public UrlSet exclude(String pattern) throws MalformedURLException { return exclude(matching(pattern)); }
public UrlSet exclude(ClassLoaderInterface parent) throws IOException { return exclude(new UrlSet(parent, this.protocols)); }