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 specifi
| 58 | * All of the extensions may be controlled via configuration. |
| 59 | */ |
| 60 | public class StandardJarScanner implements JarScanner { |
| 61 | |
| 62 | private final Log log = LogFactory.getLog(StandardJarScanner.class); // must not be static |
| 63 | |
| 64 | /** |
| 65 | * Constructs a new StandardJarScanner instance. |
| 66 | */ |
| 67 | public StandardJarScanner() { |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * The string resources for this package. |
| 72 | */ |
| 73 | private static final StringManager sm = StringManager.getManager(Constants.Package); |
| 74 | |
| 75 | private static final Set<ClassLoader> CLASSLOADER_HIERARCHY; |
| 76 | |
| 77 | static { |
| 78 | Set<ClassLoader> cls = new HashSet<>(); |
| 79 | |
| 80 | ClassLoader cl = StandardJarScanner.class.getClassLoader(); |
| 81 | while (cl != null) { |
| 82 | cls.add(cl); |
| 83 | cl = cl.getParent(); |
| 84 | } |
| 85 | |
| 86 | CLASSLOADER_HIERARCHY = Collections.unmodifiableSet(cls); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Controls the classpath scanning extension. |
| 91 | */ |
| 92 | private boolean scanClassPath = true; |
| 93 | |
| 94 | /** |
| 95 | * Returns whether classpath scanning is enabled. |
| 96 | * |
| 97 | * @return true if classpath scanning is enabled |
| 98 | */ |
| 99 | public boolean isScanClassPath() { |
| 100 | return scanClassPath; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Sets whether classpath scanning is enabled. |
| 105 | * |
| 106 | * @param scanClassPath true to enable classpath scanning |
| 107 | */ |
| 108 | public void setScanClassPath(boolean scanClassPath) { |
| 109 | this.scanClassPath = scanClassPath; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Controls the JAR file Manifest scanning extension. |
| 114 | */ |
| 115 | private boolean scanManifest = true; |
| 116 | |
| 117 | /** |
nothing calls this directly
no test coverage detected