From: markt Date: Thu, 24 Dec 2009 14:37:57 +0000 (+0000) Subject: Make naming consistent with elsewhere in Tomcat X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ca5519c49b56ce2c981b4d423347542664541696;p=tomcat7.0 Make naming consistent with elsewhere in Tomcat git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@893768 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 01309f5b7..a3136298c 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -104,7 +104,7 @@ import org.apache.naming.resources.WARDirContext; import org.apache.tomcat.InstanceManager; import org.apache.tomcat.JarScanner; import org.apache.tomcat.util.modeler.Registry; -import org.apache.tomcat.util.scan.DefaultJarScanner; +import org.apache.tomcat.util.scan.StandardJarScanner; /** * Standard implementation of the Context interface. Each @@ -781,7 +781,7 @@ public class StandardContext public JarScanner getJarScanner() { if (jarScanner == null) { - jarScanner = new DefaultJarScanner(); + jarScanner = new StandardJarScanner(); } return jarScanner; } diff --git a/java/org/apache/jasper/compiler/JarScannerFactory.java b/java/org/apache/jasper/compiler/JarScannerFactory.java index d8a32344c..b48e95915 100644 --- a/java/org/apache/jasper/compiler/JarScannerFactory.java +++ b/java/org/apache/jasper/compiler/JarScannerFactory.java @@ -23,7 +23,7 @@ package org.apache.jasper.compiler; import javax.servlet.ServletContext; import org.apache.tomcat.JarScanner; -import org.apache.tomcat.util.scan.DefaultJarScanner; +import org.apache.tomcat.util.scan.StandardJarScanner; /** * Provide a mechanism for Jasper to obtain a reference to the JarScanner @@ -44,7 +44,7 @@ public class JarScannerFactory { (JarScanner) ctxt.getAttribute(JarScanner.class.getName()); if (jarScanner == null) { ctxt.log(Localizer.getMessage("jsp.warning.noJarScanner")); - jarScanner = new DefaultJarScanner(); + jarScanner = new StandardJarScanner(); } return jarScanner; } diff --git a/java/org/apache/tomcat/util/scan/DefaultJarScanner.java b/java/org/apache/tomcat/util/scan/DefaultJarScanner.java deleted file mode 100644 index ad81dc116..000000000 --- a/java/org/apache/tomcat/util/scan/DefaultJarScanner.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.tomcat.util.scan; - -import java.io.File; -import java.io.IOException; -import java.net.JarURLConnection; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.URLConnection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.StringTokenizer; - -import javax.servlet.ServletContext; - -import org.apache.juli.logging.Log; -import org.apache.juli.logging.LogFactory; -import org.apache.tomcat.JarScanner; -import org.apache.tomcat.JarScannerCallback; -import org.apache.tomcat.util.res.StringManager; - -/** - * The default {@link 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. - */ -public class DefaultJarScanner implements JarScanner { - - private static final Log log = LogFactory.getLog(DefaultJarScanner.class); - - private static final Set defaultJarsToSkip = new HashSet(); - - /** - * The string resources for this package. - */ - private static final StringManager sm = - StringManager.getManager(Constants.Package); - - static { - String jarList = System.getProperty(Constants.SKIP_JARS_PROPERTY); - if (jarList != null) { - StringTokenizer tokenizer = new StringTokenizer(jarList, ","); - while (tokenizer.hasMoreElements()) { - defaultJarsToSkip.add(tokenizer.nextToken()); - } - } - } - - /** - * Controls the classpath scanning extension. - */ - private boolean scanClassPath = true; - public boolean isScanClassPath() { - return scanClassPath; - } - public void setScanClassPath(boolean scanClassPath) { - this.scanClassPath = scanClassPath; - } - - /** - * Controls the testing all files to see of they are JAR files extension. - */ - private boolean scanAllFiles = false; - public boolean isScanAllFiles() { - return scanAllFiles; - } - public void setScanAllFiles(boolean scanAllFiles) { - this.scanAllFiles = scanAllFiles; - } - - /** - * Controls the testing all directories to see of they are exploded JAR - * files extension. - */ - private boolean scanAllDirectories = false; - public boolean isScanAllDirectories() { - return scanAllDirectories; - } - public void setScanAllDirectories(boolean scanAllDirectories) { - this.scanAllDirectories = scanAllDirectories; - } - - /** - * Scan the provided ServletContext and classloader for JAR files. Each JAR - * file found will be passed to the callback handler to be processed. - * - * @param context The ServletContext - used to locate and access - * WEB-INF/lib - * @param classloader The classloader - used to access JARs not in - * WEB-INF/lib - * @param callback The handler to process any JARs found - * @param jarsToSkip List of JARs to ignore. If this list is null, a - * default list will be read from the system property - * defined by {@link #SKIP_JARS_PROPERTY} - */ - @Override - public void scan(ServletContext context, ClassLoader classloader, - JarScannerCallback callback, Set jarsToSkip) { - - if (log.isTraceEnabled()) { - log.trace(sm.getString("jarScan.webinflibStart")); - } - - Set ignoredJars; - if (jarsToSkip == null) { - ignoredJars = defaultJarsToSkip; - } else { - ignoredJars = jarsToSkip; - } - - // Scan WEB-INF/lib - Set dirList = context.getResourcePaths(Constants.WEB_INF_LIB); - if (dirList != null) { - Iterator it = dirList.iterator(); - while (it.hasNext()) { - String path = it.next(); - if (path.endsWith(Constants.JAR_EXT) && - !ignoredJars.contains( - path.substring(path.lastIndexOf('/')+1))) { - // Need to scan this JAR - URL url = null; - try { - url = context.getResource(path); - process(callback, url); - } catch (IOException e) { - log.warn(sm.getString("jarScan.webinflibFail", url), e); - } - } - } - } - - // Scan the classpath - if (scanClassPath) { - if (log.isTraceEnabled()) { - log.trace(sm.getString("jarScan.classloaderStart")); - } - - ClassLoader loader = - Thread.currentThread().getContextClassLoader(); - - while (loader != null) { - if (loader instanceof URLClassLoader) { - URL[] urls = ((URLClassLoader) loader).getURLs(); - for (int i=0; i + *
  • 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)
  • + * + * All of the extensions may be controlled via configuration. + */ +public class StandardJarScanner implements JarScanner { + + private static final Log log = LogFactory.getLog(StandardJarScanner.class); + + private static final Set defaultJarsToSkip = new HashSet(); + + /** + * The string resources for this package. + */ + private static final StringManager sm = + StringManager.getManager(Constants.Package); + + static { + String jarList = System.getProperty(Constants.SKIP_JARS_PROPERTY); + if (jarList != null) { + StringTokenizer tokenizer = new StringTokenizer(jarList, ","); + while (tokenizer.hasMoreElements()) { + defaultJarsToSkip.add(tokenizer.nextToken()); + } + } + } + + /** + * Controls the classpath scanning extension. + */ + private boolean scanClassPath = true; + public boolean isScanClassPath() { + return scanClassPath; + } + public void setScanClassPath(boolean scanClassPath) { + this.scanClassPath = scanClassPath; + } + + /** + * Controls the testing all files to see of they are JAR files extension. + */ + private boolean scanAllFiles = false; + public boolean isScanAllFiles() { + return scanAllFiles; + } + public void setScanAllFiles(boolean scanAllFiles) { + this.scanAllFiles = scanAllFiles; + } + + /** + * Controls the testing all directories to see of they are exploded JAR + * files extension. + */ + private boolean scanAllDirectories = false; + public boolean isScanAllDirectories() { + return scanAllDirectories; + } + public void setScanAllDirectories(boolean scanAllDirectories) { + this.scanAllDirectories = scanAllDirectories; + } + + /** + * Scan the provided ServletContext and classloader for JAR files. Each JAR + * file found will be passed to the callback handler to be processed. + * + * @param context The ServletContext - used to locate and access + * WEB-INF/lib + * @param classloader The classloader - used to access JARs not in + * WEB-INF/lib + * @param callback The handler to process any JARs found + * @param jarsToSkip List of JARs to ignore. If this list is null, a + * default list will be read from the system property + * defined by {@link #SKIP_JARS_PROPERTY} + */ + @Override + public void scan(ServletContext context, ClassLoader classloader, + JarScannerCallback callback, Set jarsToSkip) { + + if (log.isTraceEnabled()) { + log.trace(sm.getString("jarScan.webinflibStart")); + } + + Set ignoredJars; + if (jarsToSkip == null) { + ignoredJars = defaultJarsToSkip; + } else { + ignoredJars = jarsToSkip; + } + + // Scan WEB-INF/lib + Set dirList = context.getResourcePaths(Constants.WEB_INF_LIB); + if (dirList != null) { + Iterator it = dirList.iterator(); + while (it.hasNext()) { + String path = it.next(); + if (path.endsWith(Constants.JAR_EXT) && + !ignoredJars.contains( + path.substring(path.lastIndexOf('/')+1))) { + // Need to scan this JAR + URL url = null; + try { + url = context.getResource(path); + process(callback, url); + } catch (IOException e) { + log.warn(sm.getString("jarScan.webinflibFail", url), e); + } + } + } + } + + // Scan the classpath + if (scanClassPath) { + if (log.isTraceEnabled()) { + log.trace(sm.getString("jarScan.classloaderStart")); + } + + ClassLoader loader = + Thread.currentThread().getContextClassLoader(); + + while (loader != null) { + if (loader instanceof URLClassLoader) { + URL[] urls = ((URLClassLoader) loader).getURLs(); + for (int i=0; i