You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2002/08/20 01:06:02 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ImplicitTagLibraryInfo.java Parser.java ParserController.java TagFileProcessor.java
luehe 2002/08/19 16:06:01
Modified: jasper2/src/share/org/apache/jasper/compiler
ImplicitTagLibraryInfo.java Parser.java
ParserController.java TagFileProcessor.java
Log:
- When dealing with tag files underneath "/WEB-INF/tags/", *always*
generate an implicit Tag Library Descriptor, regardless of whether a
TLD file is present in the tag file directory
- Removed 'name' attribute from tag directive.
Revision Changes Path
1.6 +4 -31 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
Index: ImplicitTagLibraryInfo.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ImplicitTagLibraryInfo.java 31 Jul 2002 23:45:50 -0000 1.5
+++ ImplicitTagLibraryInfo.java 19 Aug 2002 23:06:01 -0000 1.6
@@ -77,14 +77,11 @@
public class ImplicitTagLibraryInfo extends TagLibraryInfo {
private static final String WEB_INF_TAGS = "/WEB-INF/tags/";
- private static final String TLD_SUFFIX = ".tld";
private static final String TAG_FILE_SUFFIX = ".tag";
private static final String TAGS_SHORTNAME = "tags";
private static final String TLIB_VERSION = "1.0";
private static final String JSP_VERSION = "2.0";
- private String tldFile;
-
/**
* Constructor.
*/
@@ -117,10 +114,7 @@
Iterator it = dirList.iterator();
while (it.hasNext()) {
String path = (String) it.next();
- if (path.endsWith(TLD_SUFFIX)) {
- tldFile = path;
- break;
- } else if (path.endsWith(TAG_FILE_SUFFIX)) {
+ if (path.endsWith(TAG_FILE_SUFFIX)) {
// use the filename of the tag file, without the .tag
// extension, as the <name> subelement of the "imaginary"
// <tag-file> element
@@ -138,26 +132,5 @@
this.tagFiles = new TagFileInfo[vec.size()];
vec.copyInto(this.tagFiles);
}
- }
-
- public static TagLibraryInfo getTabLibraryInfo(JspCompilationContext ctxt,
- ParserController pc,
- String prefix,
- String tagdir,
- ErrorDispatcher err)
- throws JasperException {
-
- TagLibraryInfo tagLibInfo = new ImplicitTagLibraryInfo(ctxt, pc,
- prefix, tagdir,
- err);
- if (((ImplicitTagLibraryInfo) tagLibInfo).tldFile != null) {
- // tagdir contains TLD file
- String[] location = new String[2];
- location[0] = ((ImplicitTagLibraryInfo) tagLibInfo).tldFile;
- tagLibInfo = new TagLibraryInfoImpl(ctxt, pc, prefix, tagdir,
- location, err);
- }
-
- return tagLibInfo;
}
}
1.21 +8 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java
Index: Parser.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Parser.java 19 Aug 2002 16:54:16 -0000 1.20
+++ Parser.java 19 Aug 2002 23:06:01 -0000 1.21
@@ -376,12 +376,11 @@
} else {
String tagdir = attrs.getValue("tagdir");
if (tagdir != null) {
- tagLibInfo = ImplicitTagLibraryInfo.getTabLibraryInfo(
- ctxt,
- parserController,
- prefix,
- tagdir,
- err);
+ tagLibInfo = new ImplicitTagLibraryInfo(ctxt,
+ parserController,
+ prefix,
+ tagdir,
+ err);
}
}
if (tagLibInfo != null) {
1.10 +0 -10 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java
Index: ParserController.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ParserController.java 31 Jul 2002 21:42:27 -0000 1.9
+++ ParserController.java 19 Aug 2002 23:06:01 -0000 1.10
@@ -322,14 +322,4 @@
new Object[]{encoding}));
}
}
-
- private void p(String s) {
- System.out.println("[ParserController] " + s);
- }
-
- private void p(String s, Throwable ex) {
- p(s);
- p(ex.getMessage());
- ex.printStackTrace();
- }
}
1.13 +9 -17 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java
Index: TagFileProcessor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TagFileProcessor.java 19 Aug 2002 16:54:16 -0000 1.12
+++ TagFileProcessor.java 19 Aug 2002 23:06:01 -0000 1.13
@@ -87,7 +87,6 @@
static class TagFileVisitor extends Node.Visitor {
private static final JspUtil.ValidAttribute[] tagDirectiveAttrs = {
- new JspUtil.ValidAttribute("name"),
new JspUtil.ValidAttribute("display-name"),
new JspUtil.ValidAttribute("body-content"),
new JspUtil.ValidAttribute("dynamic-attributes"),
@@ -146,9 +145,11 @@
private Vector fragmentAttributeVector = new Vector();
private Map fragmentAttributesMap = new Hashtable();
- public TagFileVisitor(Compiler compiler, TagLibraryInfo tagLibInfo) {
+ public TagFileVisitor(Compiler compiler, TagLibraryInfo tagLibInfo,
+ String name) {
err = compiler.getErrorDispatcher();
this.tagLibInfo = tagLibInfo;
+ this.name = name;
}
public void visit(Node.TagDirective n) throws JasperException {
@@ -156,14 +157,6 @@
JspUtil.checkAttributes("Tag directive", n, tagDirectiveAttrs,
err);
- String tname = n.getAttributeValue("name");
- if (tname != null) {
- if (name == null) {
- name = tname;
- } else if (!tname.equals(name)) {
- err.jspError("jsp.error.tagfile.tld.name", name, tname);
- }
- }
bodycontent = n.getAttributeValue("body-content");
if (bodycontent != null &&
!bodycontent.equals(TagInfo.BODY_CONTENT_EMPTY) &&
@@ -185,7 +178,7 @@
JspUtil.checkAttributes("Attribute directive", n,
attributeDirectiveAttrs, err);
- String name = n.getAttributeValue("name");
+ String attrName = n.getAttributeValue("name");
boolean required = JspUtil.booleanValue(
n.getAttributeValue("required"));
boolean rtexprvalue = JspUtil.booleanValue(
@@ -194,7 +187,7 @@
n.getAttributeValue("fragment"));
String type = n.getAttributeValue("type");
if (fragment) {
- fragmentAttributesMap.put(name, n);
+ fragmentAttributesMap.put(attrName, n);
if (type != null) {
err.jspError("jsp.error.fragmentwithtype");
}
@@ -204,7 +197,7 @@
}
attributeVector.addElement(
- new TagAttributeInfo(name, required, type, rtexprvalue,
+ new TagAttributeInfo(attrName, required, type, rtexprvalue,
fragment));
}
@@ -319,8 +312,7 @@
}
TagFileVisitor tagFileVisitor = new TagFileVisitor(pc.getCompiler(),
- tagLibInfo);
- tagFileVisitor.name = name;
+ tagLibInfo, name);
page.visit(tagFileVisitor);
return tagFileVisitor.getTagInfo();
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>