tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r801637 - in /tomcat/trunk: java/org/apache/catalina/startup/LocalStrings.properties java/org/apache/catalina/startup/TldConfig.java java/org/apache/jasper/compiler/TldLocationsCache.java webapps/docs/config/systemprops.xml
Date Thu, 06 Aug 2009 13:08:31 GMT
Author: markt
Date: Thu Aug  6 13:08:31 2009
New Revision: 801637

URL: http://svn.apache.org/viewvc?rev=801637&view=rev
Log:
TLD handling improvements
- make non standard behaviour configurable
- add a few more log messages
- sync method names

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java
    tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
    tomcat/trunk/webapps/docs/config/systemprops.xml

Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=801637&r1=801636&r2=801637&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties Thu Aug  6 13:08:31
2009
@@ -93,7 +93,9 @@
 tldConfig.addListeners=Adding {0} listeners from TLD files
 tldConfig.cce=Lifecycle event data object {0} is not a Context
 tldConfig.classloaderFail=Failed to process ''{0}'' for TLDs.
+tldConfig.classloaderStart=Scanning for TLDs in classloader hierarchy
 tldConfig.execute=Error processing TLD files for context path {0}
+tldConfig.jarUrlStart=Scanning for TLD files in URL ''{0}''
 tldConfig.webinflibStart=Scanning WEB-INF/lib for JARs containing META-INF/**/*.TLD
 tldConfig.webinflibJarFail=Failed to scan JAR ''{0}'' for TLDs
 tldConfig.webinfFail=Failed to process TLD found at ''{0}''

Modified: tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java?rev=801637&r1=801636&r2=801637&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java Thu Aug  6 13:08:31 2009
@@ -63,6 +63,12 @@
     private static final String WEB_INF = "/WEB-INF/";
     private static final String WEB_INF_LIB = "/WEB-INF/lib/";
     
+    // Configuration properties
+    private static final boolean SCAN_CLASSPATH = Boolean.valueOf(
+            System.getProperty(
+                "org.apache.jasper.compiler.TldLocationsCache.SCAN_CLASSPATH",
+                "true")).booleanValue();
+
     // Names of JARs that are known not to contain any TLDs
     private static HashSet<String> noTldJars;
 
@@ -334,7 +340,9 @@
         tldScanWebInfLib();
         
         // Stage 4 - Additional entries from the container
-        tldScanClassloaders();
+        if (SCAN_CLASSPATH) {
+            tldScanClassloaders();
+        }
 
         // Now add all the listeners we found to the listeners for this context
         String list[] = getTldListeners();
@@ -511,6 +519,10 @@
      */
     private void tldScanClassloaders() {
 
+        if (log.isTraceEnabled()) {
+            log.trace(sm.getString("tldConfig.classloaderStart"));
+        }
+
         ClassLoader loader = 
             Thread.currentThread().getContextClassLoader();
         
@@ -543,6 +555,10 @@
      * Keep in sync with o.a.j.comiler.TldLocationsCache
      */
     private void tldScanJar(URL url) throws IOException {
+        if (log.isTraceEnabled()) {
+            log.trace(sm.getString("tldConfig.jarUrlStart", url));
+        }
+
         URLConnection conn = url.openConnection();
         if (conn instanceof JarURLConnection) {
             tldScanJar((JarURLConnection) conn);

Modified: tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java?rev=801637&r1=801636&r2=801637&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java Thu Aug  6 13:08:31
2009
@@ -95,6 +95,12 @@
     private static final String JAR_EXT = ".jar";
     private static final String TLD_EXT = ".tld";
 
+    // Configuration properties
+    private static final boolean SCAN_CLASSPATH = Boolean.valueOf(
+            System.getProperty(
+                "org.apache.jasper.compiler.TldLocationsCache.SCAN_CLASSPATH",
+                "true")).booleanValue();
+
     // Names of JARs that are known not to contain any TLDs
     private static HashSet<String> noTldJars;
 
@@ -245,7 +251,9 @@
             tldScanWebXml();
             tldScanResourcePaths(WEB_INF);
             tldScanWebInfLib();
-            tldScanClassloaders();
+            if (SCAN_CLASSPATH) {
+                tldScanClassloaders();
+            }
             initialized = true;
         } catch (Exception ex) {
             throw new JasperException(Localizer.getMessage(
@@ -467,13 +475,13 @@
     private void tldScanJar(URL url) throws IOException {
         URLConnection conn = url.openConnection();
         if (conn instanceof JarURLConnection) {
-            scanJar((JarURLConnection) conn);
+            tldScanJar((JarURLConnection) conn);
         } else {
             String urlStr = url.toString();
             if (urlStr.startsWith(FILE_PROTOCOL)
                     && urlStr.endsWith(JAR_EXT)) {
                 URL jarURL = new URL("jar:" + urlStr + "!/");
-                scanJar((JarURLConnection) jarURL.openConnection());
+                tldScanJar((JarURLConnection) jarURL.openConnection());
             }
         }
     }
@@ -487,7 +495,7 @@
      * 
      * Keep in sync with o.a.c.startup.TldConfig
      */
-    private void scanJar(JarURLConnection conn) throws IOException {
+    private void tldScanJar(JarURLConnection conn) throws IOException {
 
         JarFile jarFile = null;
         String resourcePath = conn.getJarFileURL().toString();

Modified: tomcat/trunk/webapps/docs/config/systemprops.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=801637&r1=801636&r2=801637&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/systemprops.xml (original)
+++ tomcat/trunk/webapps/docs/config/systemprops.xml Thu Aug  6 13:08:31 2009
@@ -94,6 +94,15 @@
       <code>true</code> will be used.</p>
     </property>
 
+    <property name="org.apache.jasper.compiler. TldLocationsCache.SCAN_CLASSPATH">
+      <p>When scanning the class path for TLDs, should Jasper scan all JAR files
+      in the classpath, including those provided by the web application's parent
+      clasloaders? This is intended for sharing tag libraries between multiple
+      web applications by making the JAR available via the common or shared
+      classloader. If not specified, the default value of <code>true</code> will
+      be used.</p>
+    </property>
+
     <property name="org.apache.jasper.runtime. BodyContentImpl.LIMIT_BUFFER">
       <p>If <code>true</code>, any tag buffer that expands beyond
       <code>org.apache.jasper.Constants.DEFAULT_TAG_BUFFER_SIZE</code> will be



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message