You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/02/07 21:08:55 UTC
svn commit: r907468 - in /tomcat/trunk/java: javax/servlet/descriptor/
org/apache/catalina/ org/apache/catalina/core/ org/apache/catalina/deploy/
org/apache/catalina/startup/
Author: markt
Date: Sun Feb 7 20:08:54 2010
New Revision: 907468
URL: http://svn.apache.org/viewvc?rev=907468&view=rev
Log:
Servlet 3.0
Remainder of ServletContext plumbing
Plenty of scope to clean this up
Only lightly tested so far
Added:
tomcat/trunk/java/org/apache/catalina/core/ApplicationJspConfigDescriptor.java (with props)
tomcat/trunk/java/org/apache/catalina/core/ApplicationJspPropertyGroupDescriptor.java (with props)
tomcat/trunk/java/org/apache/catalina/core/ApplicationTaglibDescriptor.java (with props)
Modified:
tomcat/trunk/java/javax/servlet/descriptor/TaglibDescriptor.java
tomcat/trunk/java/org/apache/catalina/Context.java
tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
tomcat/trunk/java/org/apache/catalina/deploy/WebXml.java
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java
tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java
Modified: tomcat/trunk/java/javax/servlet/descriptor/TaglibDescriptor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/descriptor/TaglibDescriptor.java?rev=907468&r1=907467&r2=907468&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/descriptor/TaglibDescriptor.java (original)
+++ tomcat/trunk/java/javax/servlet/descriptor/TaglibDescriptor.java Sun Feb 7 20:08:54 2010
@@ -21,6 +21,6 @@
* TODO SERVLET3 - Add comments
*/
public interface TaglibDescriptor {
- public String getTaglidURI();
+ public String getTaglibURI();
public String getTaglibLocation();
}
Modified: tomcat/trunk/java/org/apache/catalina/Context.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Context.java?rev=907468&r1=907467&r2=907468&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Context.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Context.java Sun Feb 7 20:08:54 2010
@@ -20,6 +20,7 @@
import javax.servlet.ServletContext;
+import javax.servlet.descriptor.JspConfigDescriptor;
import org.apache.tomcat.JarScanner;
import org.apache.tomcat.util.http.mapper.Mapper;
@@ -624,18 +625,6 @@
/**
- * Add the given URL pattern as a jsp-property-group. This maps
- * resources that match the given pattern so they will be passed
- * to the JSP container. Though there are other elements in the
- * property group, we only care about the URL pattern here. The
- * JSP container will parse the rest.
- *
- * @param pattern URL pattern to be mapped
- */
- public void addJspMapping(String pattern);
-
-
- /**
* Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
*
* @param locale locale to map an encoding for
@@ -692,15 +681,6 @@
/**
- * Add a JSP tag library for the specified URI.
- *
- * @param uri URI, relative to the web.xml file, of this tag library
- * @param location Location of the tag library descriptor
- */
- public void addTaglib(String uri, String location);
-
-
- /**
* Add a resource which will be watched for reloading by the host auto
* deployer. Note: this will not be used in embedded mode.
*
@@ -911,23 +891,6 @@
/**
- * Return the tag library descriptor location for the specified taglib
- * URI, if any; otherwise, return <code>null</code>.
- *
- * @param uri URI, relative to the web.xml file
- */
- public String findTaglib(String uri);
-
-
- /**
- * Return the URIs of all tag libraries for which a tag library
- * descriptor location has been specified. If none are specified,
- * a zero-length array is returned.
- */
- public String[] findTaglibs();
-
-
- /**
* Return the set of watched resources for this Context. If none are
* defined, a zero length array will be returned.
*/
@@ -1078,14 +1041,6 @@
/**
- * Remove the tag library location for the specified tag library URI.
- *
- * @param uri URI, relative to the web.xml file
- */
- public void removeTaglib(String uri);
-
-
- /**
* Remove the specified watched resource name from the list associated
* with this Context.
*
@@ -1156,5 +1111,12 @@
* context.
*/
public void setEffectiveMinorVersion(int minor);
+
+
+ /**
+ * Obtain the JSP configuration for this context.
+ */
+ public JspConfigDescriptor getJspConfigDescriptor();
+
}
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=907468&r1=907467&r2=907468&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Sun Feb 7 20:08:54 2010
@@ -1375,8 +1375,7 @@
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
- // TODO SERVLET3
- return null;
+ return context.getJspConfigDescriptor();
}
Added: tomcat/trunk/java/org/apache/catalina/core/ApplicationJspConfigDescriptor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationJspConfigDescriptor.java?rev=907468&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationJspConfigDescriptor.java (added)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationJspConfigDescriptor.java Sun Feb 7 20:08:54 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.catalina.core;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.servlet.descriptor.JspConfigDescriptor;
+import javax.servlet.descriptor.JspPropertyGroupDescriptor;
+import javax.servlet.descriptor.TaglibDescriptor;
+
+public class ApplicationJspConfigDescriptor implements JspConfigDescriptor {
+
+ private Collection<JspPropertyGroupDescriptor> jspPropertyGroups =
+ new HashSet<JspPropertyGroupDescriptor>();
+
+ private Collection<TaglibDescriptor> taglibs =
+ new HashSet<TaglibDescriptor>();
+
+ @Override
+ public Collection<JspPropertyGroupDescriptor> getJspPropertyGroups() {
+ return jspPropertyGroups;
+ }
+
+ @Override
+ public Collection<TaglibDescriptor> getTaglibs() {
+ return taglibs;
+ }
+
+}
Propchange: tomcat/trunk/java/org/apache/catalina/core/ApplicationJspConfigDescriptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/trunk/java/org/apache/catalina/core/ApplicationJspConfigDescriptor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision
Added: tomcat/trunk/java/org/apache/catalina/core/ApplicationJspPropertyGroupDescriptor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationJspPropertyGroupDescriptor.java?rev=907468&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationJspPropertyGroupDescriptor.java (added)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationJspPropertyGroupDescriptor.java Sun Feb 7 20:08:54 2010
@@ -0,0 +1,171 @@
+/*
+ * 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.catalina.core;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.servlet.descriptor.JspPropertyGroupDescriptor;
+import org.apache.catalina.deploy.JspPropertyGroup;
+
+
+public class ApplicationJspPropertyGroupDescriptor
+ implements JspPropertyGroupDescriptor{
+
+ JspPropertyGroup jspPropertyGroup;
+
+
+ public ApplicationJspPropertyGroupDescriptor(
+ JspPropertyGroup jspPropertyGroup) {
+ this.jspPropertyGroup = jspPropertyGroup;
+ }
+
+
+ @Override
+ public String getBuffer() {
+ String result = null;
+
+ if (jspPropertyGroup.getBuffer() != null) {
+ result = jspPropertyGroup.getBuffer().toString();
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public String getDefaultContentType() {
+ String result = null;
+
+ if (jspPropertyGroup.getDefaultContentType() != null) {
+ result = jspPropertyGroup.getDefaultContentType().toString();
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public String getDeferredSyntaxAllowedAsLiteral() {
+ String result = null;
+
+ if (jspPropertyGroup.getDeferredSyntax() != null) {
+ result = jspPropertyGroup.getDeferredSyntax().toString();
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public String getElIgnored() {
+ String result = null;
+
+ if (jspPropertyGroup.getElIgnored() != null) {
+ result = jspPropertyGroup.getElIgnored().toString();
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public String getErrorOnUndeclaredNamespace() {
+ String result = null;
+
+ if (jspPropertyGroup.getErrorOnUndeclaredNamespace() != null) {
+ result =
+ jspPropertyGroup.getErrorOnUndeclaredNamespace().toString();
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public Collection<String> getIncludeCodas() {
+ return jspPropertyGroup.getIncludeCodas();
+ }
+
+
+ @Override
+ public Collection<String> getIncludePreludes() {
+ return jspPropertyGroup.getIncludePreludes();
+ }
+
+
+ @Override
+ public String getIsXml() {
+ String result = null;
+
+ if (jspPropertyGroup.getIsXml() != null) {
+ result = jspPropertyGroup.getIsXml().toString();
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public String getPageEncoding() {
+ String result = null;
+
+ if (jspPropertyGroup.getPageEncoding() != null) {
+ result = jspPropertyGroup.getPageEncoding().toString();
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public String getScriptingInvalid() {
+ String result = null;
+
+ if (jspPropertyGroup.getScriptingInvalid() != null) {
+ result = jspPropertyGroup.getScriptingInvalid().toString();
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public String getTrimDirectiveWhitespaces() {
+ String result = null;
+
+ if (jspPropertyGroup.getTrimWhitespace() != null) {
+ result = jspPropertyGroup.getTrimWhitespace().toString();
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public Collection<String> getUrlPatterns() {
+ Collection<String> result = new HashSet<String>();
+
+ if (jspPropertyGroup.getUrlPattern() != null) {
+ result.add(jspPropertyGroup.getUrlPattern());
+ }
+
+ return result;
+ }
+
+}
Propchange: tomcat/trunk/java/org/apache/catalina/core/ApplicationJspPropertyGroupDescriptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/trunk/java/org/apache/catalina/core/ApplicationJspPropertyGroupDescriptor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision
Added: tomcat/trunk/java/org/apache/catalina/core/ApplicationTaglibDescriptor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationTaglibDescriptor.java?rev=907468&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationTaglibDescriptor.java (added)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationTaglibDescriptor.java Sun Feb 7 20:08:54 2010
@@ -0,0 +1,81 @@
+/*
+ * 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.catalina.core;
+
+import javax.servlet.descriptor.TaglibDescriptor;
+
+public class ApplicationTaglibDescriptor implements TaglibDescriptor {
+
+ private String location;
+ private String uri;
+
+ public ApplicationTaglibDescriptor(String location, String uri) {
+ this.location = location;
+ this.uri = uri;
+ }
+
+ @Override
+ public String getTaglibLocation() {
+ return location;
+ }
+
+ @Override
+ public String getTaglibURI() {
+ return uri;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((location == null) ? 0 : location.hashCode());
+ result = prime * result + ((uri == null) ? 0 : uri.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof ApplicationTaglibDescriptor)) {
+ return false;
+ }
+ ApplicationTaglibDescriptor other = (ApplicationTaglibDescriptor) obj;
+ if (location == null) {
+ if (other.location != null) {
+ return false;
+ }
+ } else if (!location.equals(other.location)) {
+ return false;
+ }
+ if (uri == null) {
+ if (other.uri != null) {
+ return false;
+ }
+ } else if (!uri.equals(other.uri)) {
+ return false;
+ }
+ return true;
+ }
+
+}
Propchange: tomcat/trunk/java/org/apache/catalina/core/ApplicationTaglibDescriptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/trunk/java/org/apache/catalina/core/ApplicationTaglibDescriptor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=907468&r1=907467&r2=907468&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Sun Feb 7 20:08:54 2010
@@ -54,6 +54,8 @@
import javax.servlet.ServletException;
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.ServletRequestListener;
+import javax.servlet.descriptor.JspConfigDescriptor;
+import javax.servlet.descriptor.TaglibDescriptor;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionListener;
@@ -563,13 +565,6 @@
/**
- * The JSP tag libraries defined in web.xml for this web application, keyed
- * by URI.
- */
- private HashMap<String, String> taglibs = new HashMap<String, String>();
-
-
- /**
* Amount of ms that the container will wait for servlets to unload.
*/
private long unloadDelay = 2000;
@@ -767,6 +762,9 @@
private int effectiveMinorVersion = 0;
+ private JspConfigDescriptor jspConfigDescriptor =
+ new ApplicationJspConfigDescriptor();
+
// ----------------------------------------------------- Context Properties
public int getEffectiveMajorVersion() {
@@ -2054,6 +2052,11 @@
}
+
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ return null;
+ }
+
// ------------------------------------------------------ Public Properties
@@ -2530,30 +2533,6 @@
}
/**
- * Add the given URL pattern as a jsp-property-group. This maps
- * resources that match the given pattern so they will be passed
- * to the JSP container. Though there are other elements in the
- * property group, we only care about the URL pattern here. The
- * JSP container will parse the rest.
- *
- * @param pattern URL pattern to be mapped
- */
- public void addJspMapping(String pattern) {
- String servletName = findServletMapping("*.jsp");
- if (servletName == null) {
- servletName = "jsp";
- }
-
- if( findChild(servletName) != null) {
- addServletMapping(pattern, servletName, true);
- } else {
- if(log.isDebugEnabled())
- log.debug("Skiping " + pattern + " , no servlet " + servletName);
- }
- }
-
-
- /**
* Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
*
* @param locale locale to map an encoding for
@@ -2734,22 +2713,6 @@
/**
- * Add a JSP tag library for the specified URI.
- *
- * @param uri URI, relative to the web.xml file, of this tag library
- * @param location Location of the tag library descriptor
- */
- public void addTaglib(String uri, String location) {
-
- synchronized (taglibs) {
- taglibs.put(uri, location);
- }
- fireContainerEvent("addTaglib", uri);
-
- }
-
-
- /**
* Add a new watched resource to the set recognized by this Context.
*
* @param name New watched resource file name
@@ -3287,36 +3250,6 @@
/**
- * Return the tag library descriptor location for the specified taglib
- * URI, if any; otherwise, return <code>null</code>.
- *
- * @param uri URI, relative to the web.xml file
- */
- public String findTaglib(String uri) {
-
- synchronized (taglibs) {
- return (taglibs.get(uri));
- }
-
- }
-
-
- /**
- * Return the URIs of all tag libraries for which a tag library
- * descriptor location has been specified. If none are specified,
- * a zero-length array is returned.
- */
- public String[] findTaglibs() {
-
- synchronized (taglibs) {
- String results[] = new String[taglibs.size()];
- return (taglibs.keySet().toArray(results));
- }
-
- }
-
-
- /**
* Return <code>true</code> if the specified welcome file is defined
* for this Context; otherwise return <code>false</code>.
*
@@ -3831,20 +3764,6 @@
/**
- * Remove the tag library location forthe specified tag library URI.
- *
- * @param uri URI, relative to the web.xml file
- */
- public void removeTaglib(String uri) {
-
- synchronized (taglibs) {
- taglibs.remove(uri);
- }
- fireContainerEvent("removeTaglib", uri);
- }
-
-
- /**
* Remove the specified watched resource name from the list associated
* with this Context.
*
@@ -4968,7 +4887,7 @@
applicationListeners = new String[0];
applicationEventListenersObjects = new Object[0];
applicationLifecycleListenersObjects = new Object[0];
- taglibs = new HashMap<String, String>();
+ jspConfigDescriptor = new ApplicationJspConfigDescriptor();
if(log.isDebugEnabled())
log.debug("resetContext " + oname);
Modified: tomcat/trunk/java/org/apache/catalina/deploy/WebXml.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/WebXml.java?rev=907468&r1=907467&r2=907468&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/deploy/WebXml.java (original)
+++ tomcat/trunk/java/org/apache/catalina/deploy/WebXml.java Sun Feb 7 20:08:54 2010
@@ -34,9 +34,13 @@
import javax.servlet.MultipartConfigElement;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspPropertyGroupDescriptor;
+import javax.servlet.descriptor.TaglibDescriptor;
import org.apache.catalina.Context;
import org.apache.catalina.Wrapper;
+import org.apache.catalina.core.ApplicationJspPropertyGroupDescriptor;
+import org.apache.catalina.core.ApplicationTaglibDescriptor;
import org.apache.tomcat.util.res.StringManager;
/**
@@ -1161,7 +1165,12 @@
for (FilterMap filterMap : filterMaps) {
context.addFilterMap(filterMap);
}
- // jsp-property-group needs to be after servlet configuration
+ for (JspPropertyGroup jspPropertyGroup : jspPropertyGroups) {
+ JspPropertyGroupDescriptor descriptor =
+ new ApplicationJspPropertyGroupDescriptor(jspPropertyGroup);
+ context.getJspConfigDescriptor().getJspPropertyGroups().add(
+ descriptor);
+ }
for (String listener : listeners) {
context.addApplicationListener(listener);
}
@@ -1279,7 +1288,9 @@
}
}
for (Entry<String, String> entry : taglibs.entrySet()) {
- context.addTaglib(entry.getKey(), entry.getValue());
+ TaglibDescriptor descriptor = new ApplicationTaglibDescriptor(
+ entry.getKey(), entry.getValue());
+ context.getJspConfigDescriptor().getTaglibs().add(descriptor);
}
// Context doesn't use version directly
@@ -1289,9 +1300,7 @@
}
// Do this last as it depends on servlets
- for (JspPropertyGroup jspPropertyGroup : jspPropertyGroups) {
- context.addJspMapping(jspPropertyGroup.getUrlPattern());
- }
+ // TODO
}
/**
Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=907468&r1=907467&r2=907468&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Sun Feb 7 20:08:54 2010
@@ -1024,12 +1024,6 @@
// FIXME : Removing status pages
- // Removing taglibs
- String[] taglibs = context.findTaglibs();
- for (i = 0; i < taglibs.length; i++) {
- context.removeTaglib(taglibs[i]);
- }
-
// Removing welcome files
String[] welcomeFiles = context.findWelcomeFiles();
for (i = 0; i < welcomeFiles.length; i++) {
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=907468&r1=907467&r2=907468&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java Sun Feb 7 20:08:54 2010
@@ -25,6 +25,7 @@
import java.io.InputStream;
import java.net.JarURLConnection;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
@@ -34,6 +35,7 @@
import java.util.jar.JarFile;
import javax.servlet.ServletContext;
+import javax.servlet.descriptor.TaglibDescriptor;
import org.apache.catalina.Context;
import org.apache.catalina.Lifecycle;
@@ -151,7 +153,9 @@
* instance of any URI will be processed.
*/
private Set<String> taglibUris = new HashSet<String>();
-
+
+ private Set<String> webxmlTaglibUris = new HashSet<String>();
+
private ArrayList<String> listeners = new ArrayList<String>();
// --------------------------------------------------------- Public Methods
@@ -171,6 +175,13 @@
}
/**
+ * Determines if the provided URI is a known taglib URI.
+ */
+ public boolean isKnownWebxmlTaglibUri(String uri) {
+ return webxmlTaglibUris.contains(uri);
+ }
+
+ /**
* Sets the list of JARs that are known not to contain any TLDs.
*
* @param jarNames List of comma-separated names of JAR files that are
@@ -348,10 +359,12 @@
if (log.isTraceEnabled()) {
log.trace(sm.getString("tldConfig.webxmlStart"));
}
-
- String taglibs[] = context.findTaglibs();
- for (int i = 0; i < taglibs.length; i++) {
- String resourcePath = context.findTaglib(taglibs[i]);
+
+ Collection<TaglibDescriptor> descriptors =
+ context.getJspConfigDescriptor().getTaglibs();
+
+ for (TaglibDescriptor descriptor : descriptors) {
+ String resourcePath = descriptor.getTaglibLocation();
// Note: Whilst the Servlet 2.4 DTD implies that the location must
// be a context-relative path starting with '/', JSP.7.3.6.1 states
// explicitly how paths that do not start with '/' should be
@@ -359,22 +372,23 @@
if (!resourcePath.startsWith("/")) {
resourcePath = WEB_INF + resourcePath;
}
- if (taglibUris.contains(taglibs[i])) {
+ if (taglibUris.contains(descriptor.getTaglibURI())) {
log.warn(sm.getString("tldConfig.webxmlSkip", resourcePath,
- taglibs[i]));
+ descriptor.getTaglibURI()));
} else {
if (log.isTraceEnabled()) {
log.trace(sm.getString("tldConfig.webxmlAdd", resourcePath,
- taglibs[i]));
+ descriptor.getTaglibURI()));
}
try {
InputStream stream = context.getServletContext(
).getResourceAsStream(resourcePath);
tldScanStream(stream);
- taglibUris.add(taglibs[i]);
+ taglibUris.add(descriptor.getTaglibURI());
+ webxmlTaglibUris.add(descriptor.getTaglibURI());
} catch (IOException ioe) {
log.warn(sm.getString("tldConfig.webxmlFail", resourcePath,
- taglibs[i]), ioe);
+ descriptor.getTaglibURI()), ioe);
}
}
}
@@ -564,6 +578,7 @@
}
} else if (event.getType().equals(Lifecycle.STOP_EVENT)) {
taglibUris.clear();
+ webxmlTaglibUris.clear();
listeners.clear();
}
}
Modified: tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java?rev=907468&r1=907467&r2=907468&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/TldRuleSet.java Sun Feb 7 20:08:54 2010
@@ -140,14 +140,14 @@
duplicateUri = true;
// This is expected if the URI was defined in web.xml
// Log message at debug in this case
- if (tldConfig.getContext().findTaglib(text) == null) {
- digester.getLogger().info(
- "TLD skipped. URI: " + text + " is already defined");
- } else {
+ if (tldConfig.isKnownWebxmlTaglibUri(text)) {
if (digester.getLogger().isDebugEnabled()) {
digester.getLogger().debug(
"TLD skipped. URI: " + text + " is already defined");
}
+ } else {
+ digester.getLogger().info(
+ "TLD skipped. URI: " + text + " is already defined");
}
} else {
// New URI. Add it to known list and carry on
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org