Author: remy.maucherat(a)jboss.com
Date: 2009-05-27 18:27:25 -0400 (Wed, 27 May 2009)
New Revision: 1068
Added:
trunk/java/org/apache/catalina/deploy/jsp/TagLibraryValidatorInfo.java
Modified:
trunk/java/org/apache/catalina/Context.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java
trunk/java/org/apache/catalina/startup/ContextConfig.java
trunk/java/org/apache/catalina/startup/TldRuleSet.java
Log:
- Add the parsing code for TLDs.
Modified: trunk/java/org/apache/catalina/Context.java
===================================================================
--- trunk/java/org/apache/catalina/Context.java 2009-05-27 15:35:26 UTC (rev 1067)
+++ trunk/java/org/apache/catalina/Context.java 2009-05-27 22:27:25 UTC (rev 1068)
@@ -31,6 +31,7 @@
import org.apache.catalina.deploy.SecurityConstraint;
import org.apache.catalina.deploy.SessionCookie;
import org.apache.catalina.deploy.WebAbsoluteOrdering;
+import org.apache.catalina.deploy.jsp.TagLibraryInfo;
import org.apache.catalina.util.CharsetMapper;
import org.apache.tomcat.util.http.mapper.Mapper;
@@ -589,6 +590,14 @@
/**
+ * Add the given JSP tag library metadata.
+ *
+ * @param tagLibraryInfo the tag library info that will be added
+ */
+ public void addJspTagLibrary(TagLibraryInfo tagLibraryInfo);
+
+
+ /**
* Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
*
* @param locale locale to map an encoding for
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-27 15:35:26 UTC (rev
1067)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-27 22:27:25 UTC (rev
1068)
@@ -92,6 +92,7 @@
import org.apache.catalina.deploy.SecurityConstraint;
import org.apache.catalina.deploy.SessionCookie;
import org.apache.catalina.deploy.WebAbsoluteOrdering;
+import org.apache.catalina.deploy.jsp.TagLibraryInfo;
import org.apache.catalina.loader.WebappLoader;
import org.apache.catalina.session.StandardManager;
import org.apache.catalina.startup.ContextConfig;
@@ -2270,12 +2271,28 @@
* @param pattern URL pattern to be mapped
*/
public void addJspPropertyGroup(JspPropertyGroup propertyGroup) {
+ // Add any JSP mapping specified, as it needs to be mapped to the JSP Servlet
addJspMapping(propertyGroup.getUrlPattern());
// FIXME: store locally to pass to the Jasper plugin later on
}
/**
+ * Add the given JSP tag library metadata.
+ *
+ * @param tagLibrayInfo the tag library info that will be added
+ */
+ public void addJspTagLibrary(TagLibraryInfo tagLibraryInfo) {
+ // Add listeners specified by the taglib
+ String[] listeners = tagLibraryInfo.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ addApplicationListener(listeners[i]);
+ }
+ // FIXME: store locally to pass to the Jasper plugin later on
+ }
+
+
+ /**
* Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
*
* @param locale locale to map an encoding for
Modified: trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java 2009-05-27 15:35:26 UTC
(rev 1067)
+++ trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java 2009-05-27 22:27:25 UTC
(rev 1068)
@@ -38,6 +38,8 @@
protected String uri;
protected ArrayList<String> listeners = new ArrayList<String>();
+
+ protected TagLibraryValidatorInfo validator;
/**
* An array describing the tags that are defined in this tag library.
@@ -173,4 +175,12 @@
return listeners.toArray(new String[0]);
}
+ public TagLibraryValidatorInfo getValidator() {
+ return validator;
+ }
+
+ public void setValidator(TagLibraryValidatorInfo validator) {
+ this.validator = validator;
+ }
+
}
Added: trunk/java/org/apache/catalina/deploy/jsp/TagLibraryValidatorInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/TagLibraryValidatorInfo.java
(rev 0)
+++ trunk/java/org/apache/catalina/deploy/jsp/TagLibraryValidatorInfo.java 2009-05-27
22:27:25 UTC (rev 1068)
@@ -0,0 +1,41 @@
+/*
+* 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.deploy.jsp;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TagLibraryValidatorInfo {
+
+ protected String validatorClass;
+ protected Map<String, String> initParams = new HashMap<String,
String>();
+
+ public String getValidatorClass() {
+ return validatorClass;
+ }
+ public void setValidatorClass(String validatorClass) {
+ this.validatorClass = validatorClass;
+ }
+ public void addInitParam(String name, String value) {
+ initParams.put(name, value);
+ }
+ public Map<String, String> getInitParams() {
+ return initParams;
+ }
+
+}
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-05-27 15:35:26 UTC (rev
1067)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-05-27 22:27:25 UTC (rev
1068)
@@ -108,6 +108,7 @@
import org.apache.catalina.deploy.SecurityConstraint;
import org.apache.catalina.deploy.WebAbsoluteOrdering;
import org.apache.catalina.deploy.WebOrdering;
+import org.apache.catalina.deploy.jsp.TagLibraryInfo;
import org.apache.catalina.util.StringManager;
import org.apache.naming.resources.JARDirContext;
import org.apache.naming.resources.ProxyDirContext;
@@ -621,12 +622,14 @@
ok = false;
} else {
synchronized (tldDigester) {
+ TagLibraryInfo tagLibraryInfo = new TagLibraryInfo();
try {
- tldDigester.push(context);
+ tldDigester.push(tagLibraryInfo);
tldDigester.parse(new InputSource(stream));
} finally {
tldDigester.reset();
}
+ context.addJspTagLibrary(tagLibraryInfo);
}
}
} catch (Exception e) {
Modified: trunk/java/org/apache/catalina/startup/TldRuleSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/TldRuleSet.java 2009-05-27 15:35:26 UTC (rev
1067)
+++ trunk/java/org/apache/catalina/startup/TldRuleSet.java 2009-05-27 22:27:25 UTC (rev
1068)
@@ -87,6 +87,121 @@
*/
public void addRuleInstances(Digester digester) {
+ digester.addCallMethod(prefix + "taglib/tlibversion",
+ "setTlibversion", 0);
+ digester.addCallMethod(prefix + "taglib/tlib-version",
+ "setTlibversion", 0);
+ digester.addCallMethod(prefix + "taglib/jspversion",
+ "setJspversion", 0);
+ digester.addCallMethod(prefix + "taglib/jsp-version",
+ "setJspversion", 0);
+ digester.addCallMethod(prefix + "taglib/shortname",
+ "setShortname", 0);
+ digester.addCallMethod(prefix + "taglib/short-name",
+ "setShortname", 0);
+ digester.addCallMethod(prefix + "taglib/uri",
+ "setUri", 0);
+ digester.addCallMethod(prefix + "taglib/info",
+ "setInfo", 0);
+ digester.addCallMethod(prefix + "taglib/description",
+ "setInfo", 0);
+
+ // validator element
+ digester.addObjectCreate(prefix + "taglib/validator",
+ "org.apache.catalina.deploy.jsp.TagLibraryValidatorInfo");
+ digester.addSetNext(prefix + "taglib/validator",
+ "setValidator",
+ "org.apache.catalina.deploy.jsp.TagLibraryValidatorInfo");
+ digester.addCallMethod(prefix + "taglib/validator/validator-class",
+ "setValidatorClass", 0);
+ digester.addCallMethod(prefix + "taglib/validator/init-param",
+ "addInitParam", 2);
+ digester.addCallParam(prefix +
"taglib/validator/init-param/param-name", 0);
+ digester.addCallParam(prefix +
"taglib/validator/init-param/param-value", 1);
+
+ // tag element
+ digester.addObjectCreate(prefix + "taglib/tag",
+ "org.apache.catalina.deploy.jsp.TagInfo");
+ digester.addSetNext(prefix + "taglib/tag",
+ "addTagInfo",
+ "org.apache.catalina.deploy.jsp.TagInfo");
+ digester.addCallMethod(prefix + "taglib/tag/name",
+ "setTagName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/tagclass",
+ "setTagClassName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/tag-class",
+ "setTagClassName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/teiclass",
+ "setTagExtraInfo", 0);
+ digester.addCallMethod(prefix + "taglib/tag/tei-class",
+ "setTagExtraInfo", 0);
+ digester.addCallMethod(prefix + "taglib/tag/bodycontent",
+ "setBodyContent", 0);
+ digester.addCallMethod(prefix + "taglib/tag/body-content",
+ "setBodyContent", 0);
+ digester.addCallMethod(prefix + "taglib/tag/display-name",
+ "setDisplayName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/small-icon",
+ "setSmallIcon", 0);
+ digester.addCallMethod(prefix + "taglib/tag/large-icon",
+ "setLargeIcon", 0);
+ digester.addCallMethod(prefix + "taglib/tag/icon/small-icon",
+ "setSmallIcon", 0);
+ digester.addCallMethod(prefix + "taglib/tag/icon/large-icon",
+ "setLargeIcon", 0);
+ digester.addCallMethod(prefix + "taglib/tag/info",
+ "setInfoString", 0);
+ digester.addCallMethod(prefix + "taglib/tag/description",
+ "setInfoString", 0);
+ digester.addCallMethod(prefix + "taglib/tag/dynamic-attributes",
+ "setDynamicAttributes", 0);
+
+ // tag/variable element
+ digester.addObjectCreate(prefix + "taglib/tag/variable",
+ "org.apache.catalina.deploy.jsp.TagVariableInfo");
+ digester.addSetNext(prefix + "taglib/tag/variable",
+ "addTagVariableInfo",
+ "org.apache.catalina.deploy.jsp.TagVariableInfo");
+ digester.addCallMethod(prefix + "taglib/tag/variable/name-given",
+ "setNameGiven", 0);
+ digester.addCallMethod(prefix +
"taglib/tag/variable/name-from-attribute",
+ "setNameFromAttribute", 0);
+ digester.addCallMethod(prefix + "taglib/tag/variable/class",
+ "setClassName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/variable/declare",
+ "setDeclare", 0);
+ digester.addCallMethod(prefix + "taglib/tag/variable/scope",
+ "setScope", 0);
+
+ // tag/attribute element
+ digester.addObjectCreate(prefix + "taglib/tag/attribute",
+ "org.apache.catalina.deploy.jsp.TagAttributeInfo");
+ digester.addSetNext(prefix + "taglib/tag/attribute",
+ "addTagAttributeInfo",
+ "org.apache.catalina.deploy.jsp.TagAttributeInfo");
+ digester.addCallMethod(prefix + "taglib/tag/attribute/name",
+ "setName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/type",
+ "setType", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/rtexprvalue",
+ "setReqTime", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/required",
+ "setRequired", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/fragment",
+ "setFragment", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/description",
+ "setDescription", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/required",
+ "setRequired", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/deferred-value",
+ "setDeferredValue", 0);
+ digester.addCallMethod(prefix +
"taglib/tag/attribute/deferred-value/type",
+ "setExpectedTypeName", 0);
+ digester.addCallMethod(prefix +
"taglib/tag/attribute/deferred-method",
+ "setDeferredMethod", 0);
+ digester.addCallMethod(prefix +
"taglib/tag/attribute/deferred-value/method-signature",
+ "setMethodSignature", 0);
+
digester.addCallMethod(prefix + "taglib/listener/listener-class",
"addApplicationListener", 0);