Package org.apache.struts2.util.finder
Class UrlSet
java.lang.Object
org.apache.struts2.util.finder.UrlSet
Use with ClassFinder to filter the Urls to be scanned, example:
UrlSet urlSet = new UrlSet(classLoader); urlSet = urlSet.exclude(ClassLoader.getSystemClassLoader().getParent()); urlSet = urlSet.excludeJavaExtDirs(); urlSet = urlSet.excludeJavaEndorsedDirs(); urlSet = urlSet.excludeJavaHome(); urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", "")); urlSet = urlSet.exclude(".*?/JavaVM.framework/.*"); urlSet = urlSet.exclude(".*?/activemq-(core|ra)-[\\d.]+.jar(!/)?");
- Author:
- David Blevins
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionUrlSet
(Collection<URL> urls) Ignores all URLs that are not "jar" or "file"UrlSet
(ClassLoaderInterface classLoader) UrlSet
(ClassLoaderInterface classLoader, Set<String> protocols) -
Method Summary
Modifier and TypeMethodDescriptionexclude
(ClassLoaderInterface parent) Calls excludePaths(System.getProperty("java.endorsed.dirs"))Calls excludePaths(System.getProperty("java.ext.dirs"))excludePaths
(String pathString) Calls excludePaths(System.getProperty("java.ext.dirs"))getUrls()
includeClassesUrl
(ClassLoaderInterface classLoaderInterface, UrlSet.FileProtocolNormalizer normalizer) Try to find a classes directory inside a war file add its normalized url to this set
-
Constructor Details
-
UrlSet
- Throws:
IOException
-
UrlSet
- Throws:
IOException
-
UrlSet
-
UrlSet
Ignores all URLs that are not "jar" or "file"- Parameters:
urls
- collection of URLs
-
-
Method Details
-
include
-
exclude
-
exclude
- Throws:
IOException
-
exclude
- Throws:
MalformedURLException
-
exclude
- Throws:
MalformedURLException
-
excludeJavaExtDirs
Calls excludePaths(System.getProperty("java.ext.dirs"))- Returns:
- url set
- Throws:
MalformedURLException
- in case if incorrect URL
-
excludeJavaEndorsedDirs
Calls excludePaths(System.getProperty("java.endorsed.dirs"))- Returns:
- url set
- Throws:
MalformedURLException
- in case if incorrect URL
-
excludeUserExtensionsDir
Calls excludePaths(System.getProperty("java.ext.dirs"))- Returns:
- url set
- Throws:
MalformedURLException
- in case if incorrect URL
-
excludeJavaHome
- Throws:
MalformedURLException
-
excludePaths
- Throws:
MalformedURLException
-
matching
-
includeClassesUrl
public UrlSet includeClassesUrl(ClassLoaderInterface classLoaderInterface, UrlSet.FileProtocolNormalizer normalizer) throws IOException Try to find a classes directory inside a war file add its normalized url to this set- Parameters:
classLoaderInterface
- class loader interfacenormalizer
- file protocol normalizer- Returns:
- url set
- Throws:
IOException
- in case of IO errors
-
relative
- Throws:
MalformedURLException
-
getUrls
-