Package org.apache.tomcat.util.scan
Class StandardJarScanner
java.lang.Object
org.apache.tomcat.util.scan.StandardJarScanner
- All Implemented Interfaces:
JarScanner
The default
JarScanner
implementation scans the WEB-INF/lib directory
followed by the provided classloader and then works up the classloader
hierarchy. This implementation is sufficient to meet the requirements of the
Servlet 3.0 specification as well as to provide a number of Tomcat specific
extensions. The extensions are:
- Scanning the classloader hierarchy (enabled by default)
- Testing all files to see if they are JARs (disabled by default)
- Testing all directories to see if they are exploded JARs (disabled by default)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addClassPath
(Deque<URL> classPathUrlsToProcess) protected void
doScanClassPath
(JarScanType scanType, ServletContext context, JarScannerCallback callback, Set<URL> processedURLs) boolean
boolean
boolean
boolean
boolean
protected void
process
(JarScanType scanType, JarScannerCallback callback, URL url, String webappPath, boolean isWebapp, Deque<URL> classPathUrlsToProcess) protected void
processURLs
(JarScanType scanType, JarScannerCallback callback, Set<URL> processedURLs, boolean isWebapp, Deque<URL> classPathUrlsToProcess) void
scan
(JarScanType scanType, ServletContext context, JarScannerCallback callback) Scan the provided ServletContext and class loader for JAR files.void
setJarScanFilter
(JarScanFilter jarScanFilter) void
setScanAllDirectories
(boolean scanAllDirectories) void
setScanAllFiles
(boolean scanAllFiles) void
setScanBootstrapClassPath
(boolean scanBootstrapClassPath) void
setScanClassPath
(boolean scanClassPath) void
setScanManifest
(boolean scanManifest)
-
Constructor Details
-
StandardJarScanner
public StandardJarScanner()
-
-
Method Details
-
isScanClassPath
public boolean isScanClassPath() -
setScanClassPath
public void setScanClassPath(boolean scanClassPath) -
isScanManifest
public boolean isScanManifest() -
setScanManifest
public void setScanManifest(boolean scanManifest) -
isScanAllFiles
public boolean isScanAllFiles() -
setScanAllFiles
public void setScanAllFiles(boolean scanAllFiles) -
isScanAllDirectories
public boolean isScanAllDirectories() -
setScanAllDirectories
public void setScanAllDirectories(boolean scanAllDirectories) -
isScanBootstrapClassPath
public boolean isScanBootstrapClassPath() -
setScanBootstrapClassPath
public void setScanBootstrapClassPath(boolean scanBootstrapClassPath) -
getJarScanFilter
- Specified by:
getJarScanFilter
in interfaceJarScanner
-
setJarScanFilter
- Specified by:
setJarScanFilter
in interfaceJarScanner
-
scan
Scan the provided ServletContext and class loader for JAR files. Each JAR file found will be passed to the callback handler to be processed.- Specified by:
scan
in interfaceJarScanner
- Parameters:
scanType
- The type of JAR scan to perform. This is passed to the filter which uses it to determine how to filter the resultscontext
- The ServletContext - used to locate and access WEB-INF/libcallback
- The handler to process any JARs found
-
doScanClassPath
protected void doScanClassPath(JarScanType scanType, ServletContext context, JarScannerCallback callback, Set<URL> processedURLs) -
processURLs
protected void processURLs(JarScanType scanType, JarScannerCallback callback, Set<URL> processedURLs, boolean isWebapp, Deque<URL> classPathUrlsToProcess) -
addClassPath
-
process
protected void process(JarScanType scanType, JarScannerCallback callback, URL url, String webappPath, boolean isWebapp, Deque<URL> classPathUrlsToProcess) throws IOException - Throws:
IOException
-