Top Description Inners Fields Constructors Methods
org.apache.tomcat.util.scan

public Class StandardJarScanner

extends Object
implements JarScanner
Class Inheritance
All Implemented Interfaces
org.apache.tomcat.JarScanner
Imports
java.io.File, .IOException, java.lang.module.ResolvedModule, java.net.MalformedURLException, .URI, .URL, .URLClassLoader, java.util.ArrayDeque, .Arrays, .Collections, .Deque, .HashSet, .Optional, .Set, java.util.jar.Attributes, .Manifest, jakarta.servlet.ServletContext, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.Jar, .JarScanFilter, .JarScanType, .JarScanner, .JarScannerCallback, org.apache.tomcat.util.ExceptionUtils, org.apache.tomcat.util.buf.UriUtil, org.apache.tomcat.util.res.StringManager

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: All of the extensions may be controlled via configuration.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final Set<ClassLoader>
private JarScanFilter
jarScanFilter

Controls the filtering of the results from the scan for JARs

private final Log
private boolean
scanAllDirectories

Controls the testing all directories to see of they are exploded JAR files extension.

private boolean
scanAllFiles

Controls the testing all files to see of they are JAR files extension.

private boolean
scanBootstrapClassPath

Controls the testing of the bootstrap classpath which consists of the runtime classes provided by the JVM and any installed system extensions.

private boolean
scanClassPath

Controls the classpath scanning extension.

private boolean
scanManifest

Controls the JAR file Manifest scanning extension.

private static final StringManager
sm

The string resources for this package.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
addClassPath(Deque<URL> classPathUrlsToProcess)

protected void
doScanClassPath(JarScanType scanType, ServletContext context, JarScannerCallback callback, Set<URL> processedURLs)

public JarScanFilter
public boolean
public boolean
public boolean
public boolean
public boolean
private static boolean
protected void
process(JarScanType scanType, JarScannerCallback callback, URL url, String webappPath, boolean isWebapp, Deque<URL> classPathUrlsToProcess)

private void
processManifest(Jar jar, boolean isWebapp, Deque<URL> classPathUrlsToProcess)

protected void
processURLs(JarScanType scanType, JarScannerCallback callback, Set<URL> processedURLs, boolean isWebapp, Deque<URL> classPathUrlsToProcess)

public void
scan(JarScanType
The type of JAR scan to perform. This is passed to the filter which uses it to determine how to filter the results
scanType
,
ServletContext
The ServletContext - used to locate and access WEB-INF/lib
context
,
JarScannerCallback
The handler to process any JARs found
callback
)

Implements org.apache.tomcat.JarScanner.scan.

Scan the provided ServletContext and class loader for JAR files.

public void
public void
setScanAllDirectories(boolean scanAllDirectories)

public void
setScanAllFiles(boolean scanAllFiles)

public void
setScanBootstrapClassPath(boolean scanBootstrapClassPath)

public void
setScanClassPath(boolean scanClassPath)

public void
setScanManifest(boolean scanManifest)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CLASSLOADER_HIERARCHYback to summary
private static final Set<ClassLoader> CLASSLOADER_HIERARCHY
jarScanFilterback to summary
private JarScanFilter jarScanFilter

Controls the filtering of the results from the scan for JARs

logback to summary
private final Log log
scanAllDirectoriesback to summary
private boolean scanAllDirectories

Controls the testing all directories to see of they are exploded JAR files extension.

scanAllFilesback to summary
private boolean scanAllFiles

Controls the testing all files to see of they are JAR files extension.

scanBootstrapClassPathback to summary
private boolean scanBootstrapClassPath

Controls the testing of the bootstrap classpath which consists of the runtime classes provided by the JVM and any installed system extensions.

scanClassPathback to summary
private boolean scanClassPath

Controls the classpath scanning extension.

scanManifestback to summary
private boolean scanManifest

Controls the JAR file Manifest scanning extension.

smback to summary
private static final StringManager sm

The string resources for this package.

Constructor Detail

StandardJarScannerback to summary
public StandardJarScanner()

Method Detail

addClassPathback to summary
protected void addClassPath(Deque<URL> classPathUrlsToProcess)
doScanClassPathback to summary
protected void doScanClassPath(JarScanType scanType, ServletContext context, JarScannerCallback callback, Set<URL> processedURLs)
getJarScanFilterback to summary
public JarScanFilter getJarScanFilter()

Implements org.apache.tomcat.JarScanner.getJarScanFilter.

Annotations
@Override
isScanAllDirectoriesback to summary
public boolean isScanAllDirectories()
isScanAllFilesback to summary
public boolean isScanAllFiles()
isScanBootstrapClassPathback to summary
public boolean isScanBootstrapClassPath()
isScanClassPathback to summary
public boolean isScanClassPath()
isScanManifestback to summary
public boolean isScanManifest()
isWebappClassLoaderback to summary
private static boolean isWebappClassLoader(ClassLoader classLoader)
processback to summary
protected void process(JarScanType scanType, JarScannerCallback callback, URL url, String webappPath, boolean isWebapp, Deque<URL> classPathUrlsToProcess) throws IOException
processManifestback to summary
private void processManifest(Jar jar, boolean isWebapp, Deque<URL> classPathUrlsToProcess) throws IOException
processURLsback to summary
protected void processURLs(JarScanType scanType, JarScannerCallback callback, Set<URL> processedURLs, boolean isWebapp, Deque<URL> classPathUrlsToProcess)
scanback to summary
public void scan(JarScanType scanType, ServletContext context, JarScannerCallback callback)

Implements org.apache.tomcat.JarScanner.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.

Parameters
scanType:JarScanType

The type of JAR scan to perform. This is passed to the filter which uses it to determine how to filter the results

context:ServletContext

The ServletContext - used to locate and access WEB-INF/lib

callback:JarScannerCallback

The handler to process any JARs found

Annotations
@Override
setJarScanFilterback to summary
public void setJarScanFilter(JarScanFilter jarScanFilter)

Implements org.apache.tomcat.JarScanner.setJarScanFilter.

Annotations
@Override
setScanAllDirectoriesback to summary
public void setScanAllDirectories(boolean scanAllDirectories)
setScanAllFilesback to summary
public void setScanAllFiles(boolean scanAllFiles)
setScanBootstrapClassPathback to summary
public void setScanBootstrapClassPath(boolean scanBootstrapClassPath)
setScanClassPathback to summary
public void setScanClassPath(boolean scanClassPath)
setScanManifestback to summary
public void setScanManifest(boolean scanManifest)
org.apache.tomcat.util.scan back to summary

private Class StandardJarScanner.ClassPathEntry

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.tomcat.util.scan.StandardJarScanner.ClassPathEntry

Field Summary

Modifier and TypeField and Description
private final boolean
private final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public String
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

jarback to summary
private final boolean jar
nameback to summary
private final String name

Constructor Detail

ClassPathEntryback to summary
pack-priv ClassPathEntry(URL url)

Method Detail

getNameback to summary
public String getName()
isJarback to summary
public boolean isJar()