luehe 2003/02/23 12:57:06 Modified: jasper2/src/share/org/apache/jasper/compiler Dumper.java Generator.java JspDocumentParser.java Node.java PageDataImpl.java Parser.java TagConstants.java Validator.java Log: Preserve prefix of standard actions in XML syntax, so support prefixes other than "jsp", as in this example: <tag xmlns:blala="http://java.sun.com/JSP/Page"> <blala:root> .... </blala:root> </tag> This means that in order to determine whether an element represents a standard action, it is not safe to check for the "jsp:" prefix. Instead, we must check for the well-known "http://java.sun.com/JSP/Page" URI. Added getQName() and getLocalName() methods to Node class. Revision Changes Path 1.4 +6 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Dumper.java Index: Dumper.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Dumper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Dumper.java 17 Oct 2002 20:43:06 -0000 1.3 +++ Dumper.java 23 Feb 2003 20:57:05 -0000 1.4 @@ -209,13 +209,13 @@ } public void visit(Node.CustomTag n) throws JasperException { - printAttributes("<" + n.getName(), n.getAttributes(), ">"); + printAttributes("<" + n.getQName(), n.getAttributes(), ">"); dumpBody(n); - printString("</" + n.getName() + ">"); + printString("</" + n.getQName() + ">"); } public void visit(Node.UninterpretedTag n) throws JasperException { - String tag = n.getName(); + String tag = n.getQName(); printAttributes("<"+tag, n.getAttributes(), ">"); dumpBody(n); printString("</" + tag + ">"); 1.164 +13 -13 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.163 retrieving revision 1.164 diff -u -r1.163 -r1.164 --- Generator.java 13 Feb 2003 19:46:10 -0000 1.163 +++ Generator.java 23 Feb 2003 20:57:05 -0000 1.164 @@ -214,7 +214,7 @@ if (!n.implementsSimpleTag()) { String name = createTagHandlerPoolName(n.getPrefix(), - n.getShortName(), + n.getLocalName(), n.getAttributes()); n.setTagHandlerPoolName(name); if (!names.contains(name)) { @@ -1529,8 +1529,8 @@ TagHandlerInfo handlerInfo = getTagHandlerInfo(n); // Create variable names - String baseVar = createTagVarName(n.getName(), n.getPrefix(), - n.getShortName()); + String baseVar = createTagVarName(n.getQName(), n.getPrefix(), + n.getLocalName()); String tagEvalVar = "_jspx_eval_" + baseVar; String tagHandlerVar = "_jspx_th_" + baseVar; String tagPushBodyCountVar = "_jspx_push_body_count_" + baseVar; @@ -1662,7 +1662,7 @@ * Write begin tag */ out.printin("out.write(\"<"); - out.print(n.getName()); + out.print(n.getQName()); Attributes attrs = n.getAttributes(); if (attrs != null) { int attrsLength = attrs.getLength(); @@ -1691,7 +1691,7 @@ * Write end tag */ out.printin("out.write(\"</"); - out.print(n.getName()); + out.print(n.getQName()); out.println(">\");"); } else { out.println("/>\");"); @@ -1933,7 +1933,7 @@ Node.CustomTag tag = n.getTag(); Node.JspAttribute[] attrs = tag.getJspAttributes(); for (int i=0; i<attrs.length; i++) { - if (attrs[i].getName().equals(n.getName())) { + if (attrs[i].getName().equals(n.getQName())) { out.print(evaluateAttribute(getTagHandlerInfo(tag), attrs[i], tag, null)); break; @@ -1950,12 +1950,12 @@ handlerInfos.put(n.getPrefix(), handlerInfosByShortName); } TagHandlerInfo handlerInfo = (TagHandlerInfo) - handlerInfosByShortName.get(n.getShortName()); + handlerInfosByShortName.get(n.getLocalName()); if (handlerInfo == null) { handlerInfo = new TagHandlerInfo(n, n.getTagHandlerClass(), err); - handlerInfosByShortName.put(n.getShortName(), handlerInfo); + handlerInfosByShortName.put(n.getLocalName(), handlerInfo); } return handlerInfo; } @@ -1982,7 +1982,7 @@ n.setBeginJavaLine(out.getJavaLine()); out.printin("/* ---- "); - out.print(n.getName()); + out.print(n.getQName()); out.println(" ---- */"); // Declare AT_BEGIN scripting variables @@ -2188,7 +2188,7 @@ n.setBeginJavaLine(out.getJavaLine()); out.printin("/* ---- "); - out.print(n.getName()); + out.print(n.getQName()); out.println(" ---- */"); // Declare AT_BEGIN scripting variables 1.41 +90 -76 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java Index: JspDocumentParser.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- JspDocumentParser.java 20 Feb 2003 01:02:51 -0000 1.40 +++ JspDocumentParser.java 23 Feb 2003 20:57:05 -0000 1.41 @@ -213,7 +213,7 @@ String qName, Attributes attrs) throws SAXException { - if (directivesOnly && !qName.startsWith(JSP_DIRECTIVE)) { + if (directivesOnly && !localName.startsWith(DIRECTIVE_ACTION)) { return; } @@ -244,15 +244,16 @@ } Node node = null; - if (qName.startsWith("jsp:")) { - node = parseStandardAction(qName, attrsCopy, xmlnsAttrs, start, - current); + + if ("http://java.sun.com/JSP/Page".equals(uri)) { + node = parseStandardAction(qName, localName, attrsCopy, xmlnsAttrs, + start, current); } else { node = parseCustomAction(qName, attrsCopy, xmlnsAttrs, start, current); if (node == null) { - node = new Node.UninterpretedTag(qName, attrsCopy, xmlnsAttrs, - start, current); + node = new Node.UninterpretedTag(qName, localName, attrsCopy, + xmlnsAttrs, start, current); } } @@ -363,7 +364,7 @@ String localName, String qName) throws SAXException { - if (directivesOnly && !qName.startsWith(JSP_DIRECTIVE)) { + if (directivesOnly && !localName.startsWith(DIRECTIVE_ACTION)) { return; } @@ -489,122 +490,135 @@ //********************************************************************* // Private utility methods - private Node parseStandardAction(String qName, Attributes attrs, - Attributes xmlnsAttrs, Mark start, - Node parent) + private Node parseStandardAction(String qName, String localName, + Attributes attrs, Attributes xmlnsAttrs, + Mark start, Node parent) throws SAXException { Node node = null; - if (qName.equals(JSP_ROOT)) { + if (localName.equals(ROOT_ACTION)) { // give the <jsp:root> element the original attributes set // (attrs) instead of the copy without the xmlns: elements // (attrsCopy) - node = new Node.JspRoot(attrs, xmlnsAttrs, start, current); + node = new Node.JspRoot(qName, attrs, xmlnsAttrs, start, current); if (isTop) { pageInfo.setHasJspRoot(true); } - } else if (qName.equals(JSP_PAGE_DIRECTIVE)) { + } else if (localName.equals(PAGE_DIRECTIVE_ACTION)) { if (isTagFile) { throw new SAXParseException( - Localizer.getMessage("jsp.error.action.istagfile", qName), + Localizer.getMessage("jsp.error.action.istagfile", + localName), locator); } - node = new Node.PageDirective(attrs, xmlnsAttrs, start, current); + node = new Node.PageDirective(qName, attrs, xmlnsAttrs, start, + current); String imports = attrs.getValue("import"); // There can only be one 'import' attribute per page directive if (imports != null) { ((Node.PageDirective) node).addImport(imports); } - } else if (qName.equals(JSP_INCLUDE_DIRECTIVE)) { - node = new Node.IncludeDirective(attrs, xmlnsAttrs, start, + } else if (localName.equals(INCLUDE_DIRECTIVE_ACTION)) { + node = new Node.IncludeDirective(qName, attrs, xmlnsAttrs, start, current); processIncludeDirective(attrs.getValue("file"), node); - } else if (qName.equals(JSP_DECLARATION)) { - node = new Node.Declaration(xmlnsAttrs, start, current); - } else if (qName.equals(JSP_SCRIPTLET)) { - node = new Node.Scriptlet(xmlnsAttrs, start, current); - } else if (qName.equals(JSP_EXPRESSION)) { - node = new Node.Expression(xmlnsAttrs, start, current); - } else if (qName.equals(JSP_USE_BEAN)) { - node = new Node.UseBean(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_SET_PROPERTY)) { - node = new Node.SetProperty(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_GET_PROPERTY)) { - node = new Node.GetProperty(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_INCLUDE)) { - node = new Node.IncludeAction(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_FORWARD)) { - node = new Node.ForwardAction(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_PARAM)) { - node = new Node.ParamAction(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_PARAMS)) { - node = new Node.ParamsAction(xmlnsAttrs, start, current); - } else if (qName.equals(JSP_PLUGIN)) { - node = new Node.PlugIn(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_TEXT)) { - node = new Node.JspText(xmlnsAttrs, start, current); - } else if (qName.equals(JSP_BODY)) { - node = new Node.JspBody(xmlnsAttrs, start, current); - } else if (qName.equals(JSP_ATTRIBUTE)) { - node = new Node.NamedAttribute(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_OUTPUT)) { - node = new Node.JspOutput(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_TAG_DIRECTIVE)) { + } else if (localName.equals(DECLARATION_ACTION)) { + node = new Node.Declaration(qName, xmlnsAttrs, start, current); + } else if (localName.equals(SCRIPTLET_ACTION)) { + node = new Node.Scriptlet(qName, xmlnsAttrs, start, current); + } else if (localName.equals(EXPRESSION_ACTION)) { + node = new Node.Expression(qName, xmlnsAttrs, start, current); + } else if (localName.equals(USE_BEAN_ACTION)) { + node = new Node.UseBean(qName, attrs, xmlnsAttrs, start, current); + } else if (localName.equals(SET_PROPERTY_ACTION)) { + node = new Node.SetProperty(qName, attrs, xmlnsAttrs, start, + current); + } else if (localName.equals(GET_PROPERTY_ACTION)) { + node = new Node.GetProperty(qName, attrs, xmlnsAttrs, start, + current); + } else if (localName.equals(INCLUDE_ACTION)) { + node = new Node.IncludeAction(qName, attrs, xmlnsAttrs, start, + current); + } else if (localName.equals(FORWARD_ACTION)) { + node = new Node.ForwardAction(qName, attrs, xmlnsAttrs, start, + current); + } else if (localName.equals(PARAM_ACTION)) { + node = new Node.ParamAction(qName, attrs, xmlnsAttrs, start, + current); + } else if (localName.equals(PARAMS_ACTION)) { + node = new Node.ParamsAction(qName, xmlnsAttrs, start, current); + } else if (localName.equals(PLUGIN_ACTION)) { + node = new Node.PlugIn(qName, attrs, xmlnsAttrs, start, current); + } else if (localName.equals(TEXT_ACTION)) { + node = new Node.JspText(qName, xmlnsAttrs, start, current); + } else if (localName.equals(BODY_ACTION)) { + node = new Node.JspBody(qName, xmlnsAttrs, start, current); + } else if (localName.equals(ATTRIBUTE_ACTION)) { + node = new Node.NamedAttribute(qName, attrs, xmlnsAttrs, start, + current); + } else if (localName.equals(OUTPUT_ACTION)) { + node = new Node.JspOutput(qName, attrs, xmlnsAttrs, start, + current); + } else if (localName.equals(TAG_DIRECTIVE_ACTION)) { if (!isTagFile) { throw new SAXParseException( Localizer.getMessage("jsp.error.action.isnottagfile", - qName), + localName), locator); } - node = new Node.TagDirective(attrs, xmlnsAttrs, start, current); + node = new Node.TagDirective(qName, attrs, xmlnsAttrs, start, + current); String imports = attrs.getValue("import"); // There can only be one 'import' attribute per tag directive if (imports != null) { ((Node.TagDirective) node).addImport(imports); } - } else if (qName.equals(JSP_ATTRIBUTE_DIRECTIVE)) { + } else if (localName.equals(ATTRIBUTE_DIRECTIVE_ACTION)) { if (!isTagFile) { throw new SAXParseException( Localizer.getMessage("jsp.error.action.isnottagfile", - qName), + localName), locator); } - node = new Node.AttributeDirective(attrs, xmlnsAttrs, start, + node = new Node.AttributeDirective(qName, attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_VARIABLE_DIRECTIVE)) { + } else if (localName.equals(VARIABLE_DIRECTIVE_ACTION)) { if (!isTagFile) { throw new SAXParseException( Localizer.getMessage("jsp.error.action.isnottagfile", - qName), + localName), locator); } - node = new Node.VariableDirective(attrs, xmlnsAttrs, start, + node = new Node.VariableDirective(qName, attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_INVOKE)) { + } else if (localName.equals(INVOKE_ACTION)) { if (!isTagFile) { throw new SAXParseException( Localizer.getMessage("jsp.error.action.isnottagfile", - qName), + localName), locator); } - node = new Node.InvokeAction(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_DO_BODY)) { + node = new Node.InvokeAction(qName, attrs, xmlnsAttrs, start, + current); + } else if (localName.equals(DOBODY_ACTION)) { if (!isTagFile) { throw new SAXParseException( Localizer.getMessage("jsp.error.action.isnottagfile", - qName), + localName), locator); } - node = new Node.DoBodyAction(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_ELEMENT)) { - node = new Node.JspElement(attrs, xmlnsAttrs, start, current); - } else if (qName.equals(JSP_FALLBACK)) { - node = new Node.FallBackAction(xmlnsAttrs, start, current); + node = new Node.DoBodyAction(qName, attrs, xmlnsAttrs, start, + current); + } else if (localName.equals(ELEMENT_ACTION)) { + node = new Node.JspElement(qName, attrs, xmlnsAttrs, start, + current); + } else if (localName.equals(FALLBACK_ACTION)) { + node = new Node.FallBackAction(qName, xmlnsAttrs, start, current); } else { throw new SAXParseException( Localizer.getMessage("jsp.error.xml.badStandardAction", - qName), + localName), locator); } @@ -656,9 +670,9 @@ tagInfo = tagFileInfo.getTagInfo(); } - return new Node.CustomTag(attrs, xmlnsAttrs, start, qName, prefix, - shortName, tagInfo, tagFileInfo, - tagHandlerClass, parent); + return new Node.CustomTag(qName, prefix, shortName, attrs, xmlnsAttrs, + start, parent, tagInfo, tagFileInfo, + tagHandlerClass); } /* @@ -789,11 +803,11 @@ for (int i=0; i<size; i++) { Node n = body.getNode(i); if (!(n instanceof Node.TemplateText)) { - String elemType = JSP_SCRIPTLET; + String elemType = SCRIPTLET_ACTION; if (scriptingElem instanceof Node.Declaration) - elemType = JSP_DECLARATION; + elemType = DECLARATION_ACTION; if (scriptingElem instanceof Node.Expression) - elemType = JSP_EXPRESSION; + elemType = EXPRESSION_ACTION; String msg = Localizer.getMessage( "jsp.error.parse.xml.scripting.invalid.body", elemType); 1.61 +189 -146 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java Index: Node.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- Node.java 20 Feb 2003 17:36:29 -0000 1.60 +++ Node.java 23 Feb 2003 20:57:05 -0000 1.61 @@ -78,7 +78,7 @@ * @author Mark Roth */ -abstract class Node { +abstract class Node implements TagConstants { private static final VariableInfo[] ZERO_VARIABLE_INFO = { }; @@ -91,6 +91,8 @@ protected int endJavaLine; protected Node parent; protected Nodes namedAttributeNodes; // cached for performance + protected String qName; + protected String localName; private boolean isDummy; @@ -103,6 +105,7 @@ /** * Constructor. + * * @param start The location of the jsp page * @param parent The enclosing node */ @@ -114,11 +117,33 @@ /** * Constructor. + * + * @param qName The action's qualified name + * @param localName The action's local name + * @param start The location of the jsp page + * @param parent The enclosing node + */ + public Node(String qName, String localName, Mark start, Node parent) { + this.qName = qName; + this.localName = localName; + this.startMark = start; + this.isDummy = (start == null); + addToParent(parent); + } + + /** + * Constructor. + * + * @param qName The action's qualified name + * @param localName The action's local name * @param attrs The attributes for this node * @param start The location of the jsp page * @param parent The enclosing node */ - public Node(Attributes attrs, Mark start, Node parent) { + public Node(String qName, String localName, Attributes attrs, Mark start, + Node parent) { + this.qName = qName; + this.localName = localName; this.attrs = attrs; this.startMark = start; this.isDummy = (start == null); @@ -127,13 +152,18 @@ /** * Constructor. + * + * @param qName The action's qualified name + * @param localName The action's local name * @param attrs The attributes for this node * @param xmlnsAttrs The xmlns attributes for this node * @param start The location of the jsp page * @param parent The enclosing node */ - public Node(Attributes attrs, Attributes xmlnsAttrs, Mark start, - Node parent) { + public Node(String qName, String localName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { + this.qName = qName; + this.localName = localName; this.attrs = attrs; this.xmlnsAttrs = xmlnsAttrs; this.startMark = start; @@ -143,23 +173,37 @@ /* * Constructor. + * + * @param qName The action's qualified name + * @param localName The action's local name * @param text The text associated with this node * @param start The location of the jsp page * @param parent The enclosing node */ - public Node(String text, Mark start, Node parent) { + public Node(String qName, String localName, String text, Mark start, + Node parent) { + this.qName = qName; + this.localName = localName; this.text = text; this.startMark = start; this.isDummy = (start == null); addToParent(parent); } + public String getQName() { + return this.qName; + } + + public String getLocalName() { + return this.localName; + } + public Attributes getAttributes() { - return attrs; + return this.attrs; } public Attributes getXmlnsAttributes() { - return xmlnsAttrs; + return this.xmlnsAttrs; } public void setAttributes(Attributes attrs) { @@ -390,9 +434,11 @@ */ public static class JspRoot extends Root { - public JspRoot(Attributes attrs, Attributes xmlnsAttrs, Mark start, - Node parent) { + public JspRoot(String qName, Attributes attrs, Attributes xmlnsAttrs, + Mark start, Node parent) { super(start, parent); + this.qName = qName; + this.localName = ROOT_ACTION; this.attrs = attrs; this.xmlnsAttrs = xmlnsAttrs; } @@ -414,12 +460,13 @@ private Vector imports; public PageDirective(Attributes attrs, Mark start, Node parent) { - this(attrs, null, start, parent); + this(JSP_PAGE_DIRECTIVE_ACTION, attrs, null, start, parent); } - public PageDirective(Attributes attrs, Attributes xmlnsAttrs, - Mark start, Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public PageDirective(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { + super(qName, PAGE_DIRECTIVE_ACTION, attrs, xmlnsAttrs, start, + parent); imports = new Vector(); } @@ -459,12 +506,14 @@ public static class IncludeDirective extends Node { public IncludeDirective(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_INCLUDE_DIRECTIVE_ACTION, attrs, null, start, parent); } - public IncludeDirective(Attributes attrs, Attributes xmlnsAttrs, - Mark start, Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public IncludeDirective(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, + Node parent) { + super(qName, INCLUDE_DIRECTIVE_ACTION, attrs, xmlnsAttrs, start, + parent); } public void accept(Visitor v) throws JasperException { @@ -478,7 +527,8 @@ public static class TaglibDirective extends Node { public TaglibDirective(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + super(JSP_TAGLIB_DIRECTIVE_ACTION, TAGLIB_DIRECTIVE_ACTION, attrs, + start, parent); } public void accept(Visitor v) throws JasperException { @@ -493,12 +543,13 @@ private Vector imports; public TagDirective(Attributes attrs, Mark start, Node parent) { - this(attrs, null, start, parent); + this(JSP_TAG_DIRECTIVE_ACTION, attrs, null, start, parent); } - public TagDirective(Attributes attrs, Attributes xmlnsAttrs, - Mark start, Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public TagDirective(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { + super(qName, TAG_DIRECTIVE_ACTION, attrs, xmlnsAttrs, start, + parent); imports = new Vector(); } @@ -538,12 +589,14 @@ public static class AttributeDirective extends Node { public AttributeDirective(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_ATTRIBUTE_DIRECTIVE_ACTION, attrs, null, start, parent); } - public AttributeDirective(Attributes attrs, Attributes xmlnsAttrs, - Mark start, Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public AttributeDirective(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, + Node parent) { + super(qName, ATTRIBUTE_DIRECTIVE_ACTION, attrs, xmlnsAttrs, start, + parent); } public void accept(Visitor v) throws JasperException { @@ -557,12 +610,14 @@ public static class VariableDirective extends Node { public VariableDirective(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_VARIABLE_DIRECTIVE_ACTION, attrs, null, start, parent); } - public VariableDirective(Attributes attrs, Attributes xmlnsAttrs, + public VariableDirective(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { - super(attrs, xmlnsAttrs, start, parent); + super(qName, VARIABLE_DIRECTIVE_ACTION, attrs, xmlnsAttrs, start, + parent); } public void accept(Visitor v) throws JasperException { @@ -576,12 +631,12 @@ public static class InvokeAction extends Node { public InvokeAction(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_INVOKE_ACTION, attrs, null, start, parent); } - public InvokeAction(Attributes attrs, Attributes xmlnsAttrs, - Mark start, Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public InvokeAction(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { + super(qName, INVOKE_ACTION, attrs, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -595,12 +650,12 @@ public static class DoBodyAction extends Node { public DoBodyAction(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_DOBODY_ACTION, attrs, null, start, parent); } - public DoBodyAction(Attributes attrs, Attributes xmlnsAttrs, - Mark start, Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public DoBodyAction(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { + super(qName, DOBODY_ACTION, attrs, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -615,7 +670,7 @@ public static class Comment extends Node { public Comment(String text, Mark start, Node parent) { - super(text, start, parent); + super(null, null, text, start, parent); } public void accept(Visitor v) throws JasperException { @@ -628,13 +683,15 @@ */ public static abstract class ScriptingElement extends Node { - public ScriptingElement(String text, Mark start, Node parent) { - super(text, start, parent); + public ScriptingElement(String qName, String localName, String text, + Mark start, Node parent) { + super(qName, localName, text, start, parent); } - public ScriptingElement(Attributes xmlnsAttrs, Mark start, + public ScriptingElement(String qName, String localName, + Attributes xmlnsAttrs, Mark start, Node parent) { - super(null, xmlnsAttrs, start, parent); + super(qName, localName, null, xmlnsAttrs, start, parent); } /** @@ -663,11 +720,13 @@ public static class Declaration extends ScriptingElement { public Declaration(String text, Mark start, Node parent) { - super(text, start, parent); + super(JSP_DECLARATION_ACTION, DECLARATION_ACTION, text, start, + parent); } - public Declaration(Attributes xmlnsAttrs, Mark start, Node parent) { - super(xmlnsAttrs, start, parent); + public Declaration(String qName, Attributes xmlnsAttrs, Mark start, + Node parent) { + super(qName, DECLARATION_ACTION, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -682,11 +741,13 @@ public static class Expression extends ScriptingElement { public Expression(String text, Mark start, Node parent) { - super(text, start, parent); + super(JSP_EXPRESSION_ACTION, EXPRESSION_ACTION, text, start, + parent); } - public Expression(Attributes xmlnsAttrs, Mark start, Node parent) { - super(xmlnsAttrs, start, parent); + public Expression(String qName, Attributes xmlnsAttrs, Mark start, + Node parent) { + super(qName, EXPRESSION_ACTION, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -700,11 +761,12 @@ public static class Scriptlet extends ScriptingElement { public Scriptlet(String text, Mark start, Node parent) { - super(text, start, parent); + super(JSP_SCRIPTLET_ACTION, SCRIPTLET_ACTION, text, start, parent); } - public Scriptlet(Attributes xmlnsAttrs, Mark start, Node parent) { - super(xmlnsAttrs, start, parent); + public Scriptlet(String qName, Attributes xmlnsAttrs, Mark start, + Node parent) { + super(qName, SCRIPTLET_ACTION, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -719,7 +781,7 @@ public static class ELExpression extends Node { public ELExpression(String text, Mark start, Node parent) { - super(text, start, parent); + super(null, null, text, start, parent); } public void accept(Visitor v) throws JasperException { @@ -735,12 +797,12 @@ JspAttribute value; public ParamAction(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_PARAM_ACTION, attrs, null, start, parent); } - public ParamAction(Attributes attrs, Attributes xmlnsAttrs, Mark start, - Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public ParamAction(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { + super(qName, PARAM_ACTION, attrs, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -762,11 +824,12 @@ public static class ParamsAction extends Node { public ParamsAction(Mark start, Node parent) { - this(null, start, parent); + this(JSP_PARAMS_ACTION, null, start, parent); } - public ParamsAction(Attributes xmlnsAttrs, Mark start, Node parent) { - super(null, xmlnsAttrs, start, parent); + public ParamsAction(String qName, Attributes xmlnsAttrs, Mark start, + Node parent) { + super(qName, PARAMS_ACTION, null, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -780,11 +843,12 @@ public static class FallBackAction extends Node { public FallBackAction(Mark start, Node parent) { - super(start, parent); + this(JSP_FALLBACK_ACTION, null, start, parent); } - public FallBackAction(Attributes xmlnsAttrs, Mark start, Node parent) { - super(null, xmlnsAttrs, start, parent); + public FallBackAction(String qName, Attributes xmlnsAttrs, Mark start, + Node parent) { + super(qName, FALLBACK_ACTION, null, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -800,12 +864,12 @@ private JspAttribute page; public IncludeAction(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_INCLUDE_ACTION, attrs, null, start, parent); } - public IncludeAction(Attributes attrs, Attributes xmlnsAttrs, - Mark start, Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public IncludeAction(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { + super(qName, INCLUDE_ACTION, attrs, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -829,12 +893,12 @@ private JspAttribute page; public ForwardAction(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_FORWARD_ACTION, attrs, null, start, parent); } - public ForwardAction(Attributes attrs, Attributes xmlnsAttrs, - Mark start, Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public ForwardAction(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { + super(qName, FORWARD_ACTION, attrs, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -856,12 +920,13 @@ public static class GetProperty extends Node { public GetProperty(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_GET_PROPERTY_ACTION, attrs, null, start, parent); } - public GetProperty(Attributes attrs, Attributes xmlnsAttrs, Mark start, - Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public GetProperty(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { + super(qName, GET_PROPERTY_ACTION, attrs, xmlnsAttrs, start, + parent); } public void accept(Visitor v) throws JasperException { @@ -877,12 +942,12 @@ private JspAttribute value; public SetProperty(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_SET_PROPERTY_ACTION, attrs, null, start, parent); } - public SetProperty(Attributes attrs, Attributes xmlsAttrs, Mark start, - Node parent) { - super(attrs, xmlsAttrs, start, parent); + public SetProperty(String qName, Attributes attrs, + Attributes xmlsAttrs, Mark start, Node parent) { + super(qName, SET_PROPERTY_ACTION, attrs, xmlsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -906,12 +971,12 @@ JspAttribute beanName; public UseBean(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_USE_BEAN_ACTION, attrs, null, start, parent); } - public UseBean(Attributes attrs, Attributes xmlnsAttrs, Mark start, - Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public UseBean(String qName, Attributes attrs, Attributes xmlnsAttrs, + Mark start, Node parent) { + super(qName, USE_BEAN_ACTION, attrs, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -936,12 +1001,12 @@ private JspAttribute height; public PlugIn(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_PLUGIN_ACTION, attrs, null, start, parent); } - public PlugIn(Attributes attrs, Attributes xmlnsAttrs, Mark start, - Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public PlugIn(String qName, Attributes attrs, Attributes xmlnsAttrs, + Mark start, Node parent) { + super(qName, PLUGIN_ACTION, attrs, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -970,22 +1035,15 @@ */ public static class UninterpretedTag extends Node { - private String tagName; - - public UninterpretedTag(String name, Attributes attrs, - Attributes xmlnsAttrs, Mark start, - Node parent) { - super(attrs, xmlnsAttrs, start, parent); - tagName = name; + public UninterpretedTag(String qName, String localName, + Attributes attrs, Attributes xmlnsAttrs, + Mark start, Node parent) { + super(qName, localName, attrs, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { v.visit(this); } - - public String getName() { - return tagName; - } } /** @@ -996,12 +1054,12 @@ private JspAttribute[] jspAttrs; public JspElement(Attributes attrs, Mark start, Node parent) { - super(attrs, start, parent); + this(JSP_ELEMENT_ACTION, attrs, null, start, parent); } - public JspElement(Attributes attrs, Attributes xmlnsAttrs, Mark start, - Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public JspElement(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { + super(qName, ELEMENT_ACTION, attrs, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -1022,9 +1080,9 @@ */ public static class JspOutput extends Node { - public JspOutput(Attributes attrs, Attributes xmlnsAttrs, Mark start, - Node parent) { - super(attrs, xmlnsAttrs, start, parent); + public JspOutput(String qName, Attributes attrs, Attributes xmlnsAttrs, + Mark start, Node parent) { + super(qName, OUTPUT_ACTION, attrs, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -1090,9 +1148,8 @@ * Represents a custom tag */ public static class CustomTag extends Node { - private String name; + private String prefix; - private String shortName; private JspAttribute[] jspAttrs; private TagData tagData; private String tagHandlerPoolName; @@ -1125,23 +1182,21 @@ private Nodes atSTag; private Nodes atETag; - public CustomTag(Attributes attrs, Mark start, - String name, String prefix, String shortName, + public CustomTag(String qName, String prefix, String localName, + Attributes attrs, Mark start, Node parent, TagInfo tagInfo, TagFileInfo tagFileInfo, - Class tagHandlerClass, Node parent) { - this(attrs, null, start, name, prefix, shortName, tagInfo, - tagFileInfo, tagHandlerClass, parent); + Class tagHandlerClass) { + this(qName, prefix, localName, attrs, null, start, parent, tagInfo, + tagFileInfo, tagHandlerClass); } - public CustomTag(Attributes attrs, Attributes xmlnsAttrs, Mark start, - String name, String prefix, String shortName, - TagInfo tagInfo, TagFileInfo tagFileInfo, - Class tagHandlerClass, Node parent) { + public CustomTag(String qName, String prefix, String localName, + Attributes attrs, Attributes xmlnsAttrs, Mark start, + Node parent, TagInfo tagInfo, TagFileInfo tagFileInfo, + Class tagHandlerClass) { - super(attrs, xmlnsAttrs, start, parent); - this.name = name; + super(qName, localName, attrs, xmlnsAttrs, start, parent); this.prefix = prefix; - this.shortName = shortName; this.tagInfo = tagInfo; this.tagFileInfo = tagFileInfo; this.tagHandlerClass = tagHandlerClass; @@ -1175,26 +1230,12 @@ } /** - * @return The full tag name - */ - public String getName() { - return name; - } - - /** * @return The tag prefix */ public String getPrefix() { return prefix; } - /** - * @return The tag name without prefix - */ - public String getShortName() { - return shortName; - } - public void setJspAttributes(JspAttribute[] jspAttrs) { this.jspAttrs = jspAttrs; } @@ -1410,7 +1451,7 @@ Node p = parent; while (p != null) { if ((p instanceof Node.CustomTag) - && name.equals(((Node.CustomTag) p).name)) { + && qName.equals(((Node.CustomTag) p).qName)) { n++; } p = p.parent; @@ -1482,8 +1523,9 @@ */ public static class JspText extends Node { - public JspText(Attributes xmlnsAttrs, Mark start, Node parent) { - super(null, xmlnsAttrs, start, parent); + public JspText(String qName, Attributes xmlnsAttrs, Mark start, + Node parent) { + super(qName, TEXT_ACTION, null, xmlnsAttrs, start, parent); } public void accept(Visitor v) throws JasperException { @@ -1508,13 +1550,13 @@ private String prefix; public NamedAttribute(Attributes attrs, Mark start, Node parent) { - this(attrs, null, start, parent); + this(JSP_ATTRIBUTE_ACTION, attrs, null, start, parent); } - public NamedAttribute(Attributes attrs, Attributes xmlnsAttrs, - Mark start, Node parent) { + public NamedAttribute(String qName, Attributes attrs, + Attributes xmlnsAttrs, Mark start, Node parent) { - super(attrs, xmlnsAttrs, start, parent); + super(qName, ATTRIBUTE_ACTION, attrs, xmlnsAttrs, start, parent); temporaryVariableName = JspUtil.nextTemporaryVariableName(); if( "false".equals( this.getAttributeValue( "trim" ) ) ) { // (if null or true, leave default of true) @@ -1608,11 +1650,12 @@ private ChildInfo childInfo; public JspBody(Mark start, Node parent) { - this(null, start, parent); + this(JSP_BODY_ACTION, null, start, parent); } - public JspBody(Attributes xmlnsAttrs, Mark start, Node parent) { - super(null, xmlnsAttrs, start, parent); + public JspBody(String qName, Attributes xmlnsAttrs, Mark start, + Node parent) { + super(qName, BODY_ACTION, null, xmlnsAttrs, start, parent); this.childInfo = new ChildInfo(); } @@ -1631,7 +1674,7 @@ public static class TemplateText extends Node { public TemplateText(String text, Mark start, Node parent) { - super(text, start, parent); + super(null, null, text, start, parent); } public void accept(Visitor v) throws JasperException { 1.23 +47 -46 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java Index: PageDataImpl.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- PageDataImpl.java 20 Feb 2003 01:02:51 -0000 1.22 +++ PageDataImpl.java 23 Feb 2003 20:57:05 -0000 1.23 @@ -254,7 +254,7 @@ if (n == this.root) { // top-level page appendXmlProlog(); - appendTag(JSP_ROOT, n); + appendTag(n); } else { visitBody(n); } @@ -270,7 +270,7 @@ if (n == this.root) { // top-level jsp:root element appendXmlProlog(); - appendTag(JSP_ROOT, n); + appendTag(n); } else { visitBody(n); } @@ -290,24 +290,24 @@ } public void visit(Node.Declaration n) throws JasperException { - appendTag(JSP_DECLARATION, n); + appendTag(n); } public void visit(Node.Expression n) throws JasperException { - appendTag(JSP_EXPRESSION, n); + appendTag(n); } public void visit(Node.Scriptlet n) throws JasperException { - appendTag(JSP_SCRIPTLET, n); + appendTag(n); } public void visit(Node.JspElement n) throws JasperException { - appendTag(JSP_ELEMENT, n); + appendTag(n); } public void visit(Node.ELExpression n) throws JasperException { if (!n.isXmlSyntax()) { - buf.append("<").append(JSP_TEXT); + buf.append("<").append(JSP_TEXT_ACTION); buf.append(" jsp:id=\""); buf.append(jspId++).append("\">"); } @@ -315,73 +315,73 @@ buf.append(n.getText()); buf.append("}"); if (!n.isXmlSyntax()) { - buf.append(JSP_TEXT_END); + buf.append(JSP_TEXT_ACTION_END); } buf.append("\n"); } public void visit(Node.IncludeAction n) throws JasperException { - appendTag(JSP_INCLUDE, n); + appendTag(n); } public void visit(Node.ForwardAction n) throws JasperException { - appendTag(JSP_FORWARD, n); + appendTag(n); } public void visit(Node.GetProperty n) throws JasperException { - appendTag(JSP_GET_PROPERTY, n); + appendTag(n); } public void visit(Node.SetProperty n) throws JasperException { - appendTag(JSP_SET_PROPERTY, n); + appendTag(n); } public void visit(Node.ParamAction n) throws JasperException { - appendTag(JSP_PARAM, n); + appendTag(n); } public void visit(Node.ParamsAction n) throws JasperException { - appendTag(JSP_PARAMS, n); + appendTag(n); } public void visit(Node.FallBackAction n) throws JasperException { - appendTag(JSP_FALLBACK, n); + appendTag(n); } public void visit(Node.UseBean n) throws JasperException { - appendTag(JSP_USE_BEAN, n); + appendTag(n); } public void visit(Node.PlugIn n) throws JasperException { - appendTag(JSP_PLUGIN, n); + appendTag(n); } public void visit(Node.NamedAttribute n) throws JasperException { - appendTag(JSP_ATTRIBUTE, n); + appendTag(n); } public void visit(Node.JspBody n) throws JasperException { - appendTag(JSP_BODY, n); + appendTag(n); } public void visit(Node.CustomTag n) throws JasperException { - appendTag(n.getName(), n); + appendTag(n); } public void visit(Node.UninterpretedTag n) throws JasperException { - appendTag(n.getName(), n); + appendTag(n); } public void visit(Node.JspText n) throws JasperException { - appendTag(JSP_TEXT, n); + appendTag(n); } public void visit(Node.DoBodyAction n) throws JasperException { - appendTag(JSP_DO_BODY, n); + appendTag(n); } public void visit(Node.InvokeAction n) throws JasperException { - appendTag(JSP_INVOKE, n); + appendTag(n); } public void visit(Node.TagDirective n) throws JasperException { @@ -389,11 +389,11 @@ } public void visit(Node.AttributeDirective n) throws JasperException { - appendTag(JSP_ATTRIBUTE_DIRECTIVE, n); + appendTag(n); } public void visit(Node.VariableDirective n) throws JasperException { - appendTag(JSP_VARIABLE_DIRECTIVE, n); + appendTag(n); } public void visit(Node.TemplateText n) throws JasperException { @@ -407,19 +407,20 @@ /* * Appends the given tag, including its body, to the XML view. */ - private void appendTag(String tag, Node n) throws JasperException { + private void appendTag(Node n) throws JasperException { Node.Nodes body = n.getBody(); String text = n.getText(); - buf.append("<").append(tag); + buf.append("<").append(n.getQName()); buf.append("\n"); buf.append(" ").append("jsp:id").append("=\""); buf.append(jspId++).append("\"\n"); printAttributes(n); - if (tag.equals(JSP_ROOT) || body != null || text != null) { + if (ROOT_ACTION.equals(n.getLocalName()) || body != null + || text != null) { buf.append(">\n"); - if (tag.equals(JSP_ROOT)) { + if (ROOT_ACTION.equals(n.getLocalName())) { if (compiler.getCompilationContext().isTagFile()) { appendTagDirective(); } else { @@ -431,7 +432,7 @@ } else { appendText(text, false); } - buf.append("</" + tag + ">\n"); + buf.append("</" + n.getQName() + ">\n"); } else { buf.append("/>\n"); } @@ -451,9 +452,9 @@ * 'pageEncoding' attributes, we ignore it, as we've already appended * a page directive containing just these two attributes. */ - private void appendPageDirective(Node.PageDirective pageDir) { + private void appendPageDirective(Node.PageDirective n) { boolean append = false; - Attributes attrs = pageDir.getAttributes(); + Attributes attrs = n.getAttributes(); int len = attrs.getLength(); for (int i=0; i<len; i++) { String attrName = attrs.getQName(i); @@ -467,7 +468,7 @@ return; } - buf.append("<").append(JSP_PAGE_DIRECTIVE); + buf.append("<").append(n.getQName()); buf.append("\n"); // append jsp:id @@ -492,10 +493,10 @@ buf.append(" ").append(attrName).append("=\""); buf.append(JspUtil.getExprInXml(value)).append("\"\n"); } - if (pageDir.getImports().size() > 0) { + if (n.getImports().size() > 0) { // Concatenate names of imported classes/packages boolean first = true; - ListIterator iter = pageDir.getImports().listIterator(); + ListIterator iter = n.getImports().listIterator(); while (iter.hasNext()) { if (first) { first = false; @@ -520,7 +521,7 @@ * ServletResponse.setContentType(), is derived from the pageInfo. */ private void appendPageDirective() { - buf.append("<").append(JSP_PAGE_DIRECTIVE); + buf.append("<").append(JSP_PAGE_DIRECTIVE_ACTION); buf.append("\n"); // append jsp:id @@ -540,11 +541,11 @@ * attributes, we ignore it, as we've already appended * a tag directive containing just this attributes. */ - private void appendTagDirective(Node.TagDirective tagDir) + private void appendTagDirective(Node.TagDirective n) throws JasperException { boolean append = false; - Attributes attrs = tagDir.getAttributes(); + Attributes attrs = n.getAttributes(); int len = attrs.getLength(); for (int i=0; i<len; i++) { String attrName = attrs.getQName(i); @@ -557,7 +558,7 @@ return; } - appendTag(JSP_TAG_DIRECTIVE, tagDir); + appendTag(n); } /* @@ -565,7 +566,7 @@ * attribute whose value is hard-coded to UTF-8. */ private void appendTagDirective() { - buf.append("<").append(JSP_TAG_DIRECTIVE); + buf.append("<").append(JSP_TAG_DIRECTIVE_ACTION); buf.append("\n"); // append jsp:id @@ -577,7 +578,7 @@ private void appendText(String text, boolean createJspTextElement) { if (createJspTextElement) { - buf.append("<").append(JSP_TEXT); + buf.append("<").append(JSP_TEXT_ACTION); buf.append("\n"); // append jsp:id @@ -586,7 +587,7 @@ buf.append(">\n"); appendCDATA(text); - buf.append(JSP_TEXT_END); + buf.append(JSP_TEXT_ACTION_END); buf.append("\n"); } else { appendCDATA(text); 1.62 +23 -23 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.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- Parser.java 20 Feb 2003 01:02:51 -0000 1.61 +++ Parser.java 23 Feb 2003 20:57:05 -0000 1.62 @@ -87,7 +87,7 @@ * @author Mark Roth */ -class Parser { +class Parser implements TagConstants { private ParserController parserController; private JspCompilationContext ctxt; @@ -1228,43 +1228,43 @@ private void parseStandardAction(Node parent) throws JasperException { Mark start = reader.mark(); - if (reader.matches("include")) { + if (reader.matches(INCLUDE_ACTION)) { parseInclude(parent); - } else if (reader.matches("forward")) { + } else if (reader.matches(FORWARD_ACTION)) { parseForward(parent); - } else if (reader.matches("invoke")) { + } else if (reader.matches(INVOKE_ACTION)) { if (!isTagFile) { err.jspError(reader.mark(), "jsp.error.invalid.action.isnottagfile", "<jsp:invoke"); } parseInvoke(parent); - } else if (reader.matches("doBody")) { + } else if (reader.matches(DOBODY_ACTION)) { if (!isTagFile) { err.jspError(reader.mark(), "jsp.error.invalid.action.isnottagfile", "<jsp:doBody"); } parseDoBody(parent); - } else if (reader.matches("getProperty")) { + } else if (reader.matches(GET_PROPERTY_ACTION)) { parseGetProperty(parent); - } else if (reader.matches("setProperty")) { + } else if (reader.matches(SET_PROPERTY_ACTION)) { parseSetProperty(parent); - } else if (reader.matches("useBean")) { + } else if (reader.matches(USE_BEAN_ACTION)) { parseUseBean(parent); - } else if (reader.matches("plugin")) { + } else if (reader.matches(PLUGIN_ACTION)) { parsePlugin(parent); - } else if (reader.matches("element")) { + } else if (reader.matches(ELEMENT_ACTION)) { parseElement(parent); - } else if (reader.matches("attribute")) { + } else if (reader.matches(ATTRIBUTE_ACTION)) { err.jspError(start, "jsp.error.namedAttribute.invalidUse"); - } else if (reader.matches("body")) { + } else if (reader.matches(BODY_ACTION)) { err.jspError(start, "jsp.error.jspbody.invalidUse"); - } else if (reader.matches("fallback")) { + } else if (reader.matches(FALLBACK_ACTION)) { err.jspError(start, "jsp.error.fallback.invalidUse"); - } else if (reader.matches("params")) { + } else if (reader.matches(PARAMS_ACTION)) { err.jspError(start, "jsp.error.params.invalidUse"); - } else if (reader.matches("param")) { + } else if (reader.matches(PARAM_ACTION)) { err.jspError(start, "jsp.error.param.invalidUse"); } else { err.jspError(start, "jsp.error.badStandardAction"); @@ -1349,8 +1349,8 @@ // Parse 'CustomActionEnd' production: if (reader.matches("/>")) { - new Node.CustomTag(attrs, start, tagName, prefix, shortTagName, - tagInfo, tagFileInfo, tagHandlerClass, parent); + new Node.CustomTag(tagName, prefix, shortTagName, attrs, start, + parent, tagInfo, tagFileInfo, tagHandlerClass); return true; } @@ -1371,9 +1371,9 @@ bc = TagInfo.BODY_CONTENT_EMPTY; } - Node tagNode = new Node.CustomTag(attrs, start, tagName, prefix, - shortTagName, tagInfo, tagFileInfo, - tagHandlerClass, parent); + Node tagNode = new Node.CustomTag(tagName, prefix, shortTagName, + attrs, start, parent, tagInfo, + tagFileInfo, tagHandlerClass); parseOptionalBody( tagNode, tagName, bc ); return true; 1.9 +81 -41 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagConstants.java Index: TagConstants.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagConstants.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TagConstants.java 8 Nov 2002 19:55:47 -0000 1.8 +++ TagConstants.java 23 Feb 2003 20:57:05 -0000 1.9 @@ -62,52 +62,92 @@ public interface TagConstants { - public static final String JSP_DIRECTIVE = "jsp:directive."; - public static final String JSP_ROOT = "jsp:root"; - public static final String JSP_ROOT_END = "</jsp:root>"; - public static final String JSP_PAGE_DIRECTIVE = "jsp:directive.page"; - public static final String JSP_INCLUDE_DIRECTIVE - = "jsp:directive.include"; - public static final String JSP_DECLARATION = "jsp:declaration"; - public static final String JSP_DECLARATION_START = "<jsp:declaration>"; - public static final String JSP_DECLARATION_END = "</jsp:declaration>"; - public static final String JSP_SCRIPTLET = "jsp:scriptlet"; - public static final String JSP_SCRIPTLET_START = "<jsp:scriptlet>"; - public static final String JSP_SCRIPTLET_END = "</jsp:scriptlet>"; - public static final String JSP_EXPRESSION = "jsp:expression"; - public static final String JSP_EXPRESSION_START = "<jsp:expression>"; - public static final String JSP_EXPRESSION_END = "</jsp:expression>"; - public static final String JSP_USE_BEAN = "jsp:useBean"; - public static final String JSP_SET_PROPERTY = "jsp:setProperty"; - public static final String JSP_GET_PROPERTY = "jsp:getProperty"; - public static final String JSP_INCLUDE = "jsp:include"; - public static final String JSP_FORWARD = "jsp:forward"; - public static final String JSP_PARAM = "jsp:param"; - public static final String JSP_PARAMS = "jsp:params"; - public static final String JSP_PLUGIN = "jsp:plugin"; - public static final String JSP_FALLBACK = "jsp:fallback"; - public static final String JSP_TEXT = "jsp:text"; - public static final String JSP_TEXT_START = "<jsp:text>"; - public static final String JSP_TEXT_END = "</jsp:text>"; - public static final String JSP_ATTRIBUTE = "jsp:attribute"; - public static final String JSP_BODY = "jsp:body"; - public static final String JSP_ELEMENT = "jsp:element"; - public static final String JSP_OUTPUT = "jsp:output"; + public static final String DIRECTIVE_ACTION = "directive."; + + public static final String ROOT_ACTION = "root"; + public static final String JSP_ROOT_ACTION = "jsp:root"; + + public static final String PAGE_DIRECTIVE_ACTION = "directive.page"; + public static final String JSP_PAGE_DIRECTIVE_ACTION = "jsp:directive.page"; + + public static final String INCLUDE_DIRECTIVE_ACTION = "directive.include"; + public static final String JSP_INCLUDE_DIRECTIVE_ACTION = "jsp:directive.include"; + + public static final String DECLARATION_ACTION = "declaration"; + public static final String JSP_DECLARATION_ACTION = "jsp:declaration"; + + public static final String SCRIPTLET_ACTION = "scriptlet"; + public static final String JSP_SCRIPTLET_ACTION = "jsp:scriptlet"; + + public static final String EXPRESSION_ACTION = "expression"; + public static final String JSP_EXPRESSION_ACTION = "jsp:expression"; + + public static final String USE_BEAN_ACTION = "useBean"; + public static final String JSP_USE_BEAN_ACTION = "jsp:useBean"; + + public static final String SET_PROPERTY_ACTION = "setProperty"; + public static final String JSP_SET_PROPERTY_ACTION = "jsp:setProperty"; + + public static final String GET_PROPERTY_ACTION = "getProperty"; + public static final String JSP_GET_PROPERTY_ACTION = "jsp:getProperty"; + + public static final String INCLUDE_ACTION = "include"; + public static final String JSP_INCLUDE_ACTION = "jsp:include"; + + public static final String FORWARD_ACTION = "forward"; + public static final String JSP_FORWARD_ACTION = "jsp:forward"; + + public static final String PARAM_ACTION = "param"; + public static final String JSP_PARAM_ACTION = "jsp:param"; + + public static final String PARAMS_ACTION = "params"; + public static final String JSP_PARAMS_ACTION = "jsp:params"; + + public static final String PLUGIN_ACTION = "plugin"; + public static final String JSP_PLUGIN_ACTION = "jsp:plugin"; + + public static final String FALLBACK_ACTION = "fallback"; + public static final String JSP_FALLBACK_ACTION = "jsp:fallback"; + + public static final String TEXT_ACTION = "text"; + public static final String JSP_TEXT_ACTION = "jsp:text"; + public static final String JSP_TEXT_ACTION_END = "</jsp:text>"; + + public static final String ATTRIBUTE_ACTION = "attribute"; + public static final String JSP_ATTRIBUTE_ACTION = "jsp:attribute"; + + public static final String BODY_ACTION = "body"; + public static final String JSP_BODY_ACTION = "jsp:body"; + + public static final String ELEMENT_ACTION = "element"; + public static final String JSP_ELEMENT_ACTION = "jsp:element"; + + public static final String OUTPUT_ACTION = "output"; + public static final String JSP_OUTPUT_ACTION = "jsp:output"; + + public static final String TAGLIB_DIRECTIVE_ACTION = "taglib"; + public static final String JSP_TAGLIB_DIRECTIVE_ACTION = "jsp:taglib"; /* * Tag Files */ - public static final String JSP_INVOKE = "jsp:invoke"; - public static final String JSP_DO_BODY = "jsp:doBody"; + public static final String INVOKE_ACTION = "invoke"; + public static final String JSP_INVOKE_ACTION = "jsp:invoke"; + + public static final String DOBODY_ACTION = "doBody"; + public static final String JSP_DOBODY_ACTION = "jsp:doBody"; /* * Tag File Directives */ - public static final String JSP_TAG_DIRECTIVE = "jsp:directive.tag"; - public static final String JSP_ATTRIBUTE_DIRECTIVE - = "jsp:directive.attribute"; - public static final String JSP_VARIABLE_DIRECTIVE - = "jsp:directive.variable"; + public static final String TAG_DIRECTIVE_ACTION = "directive.tag"; + public static final String JSP_TAG_DIRECTIVE_ACTION = "jsp:directive.tag"; + + public static final String ATTRIBUTE_DIRECTIVE_ACTION = "directive.attribute"; + public static final String JSP_ATTRIBUTE_DIRECTIVE_ACTION = "jsp:directive.attribute"; + + public static final String VARIABLE_DIRECTIVE_ACTION = "directive.variable"; + public static final String JSP_VARIABLE_DIRECTIVE_ACTION = "jsp:directive.variable"; /* * Directive attributes 1.78 +11 -11 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.77 retrieving revision 1.78 diff -u -r1.77 -r1.78 --- Validator.java 14 Feb 2003 01:36:32 -0000 1.77 +++ Validator.java 23 Feb 2003 20:57:05 -0000 1.78 @@ -673,7 +673,7 @@ public void visit(Node.CustomTag n) throws JasperException { TagInfo tagInfo = n.getTagInfo(); if (tagInfo == null) { - err.jspError(n, "jsp.error.missing.tagInfo", n.getName()); + err.jspError(n, "jsp.error.missing.tagInfo", n.getQName()); } /* @@ -684,7 +684,7 @@ if (tagInfo.hasDynamicAttributes() && !n.implementsDynamicAttributes()) { err.jspError(n, "jsp.error.dynamic.attributes.not.implemented", - n.getName()); + n.getQName()); } // Get custom actions's namespace, which is used to validate the @@ -712,7 +712,7 @@ if (tldAttrs[i].isRequired() && attr == null && jspAttr == null) { err.jspError(n, "jsp.error.missing_attribute", - tldAttrs[i].getName(), n.getShortName()); + tldAttrs[i].getName(), n.getLocalName()); } if (attr != null && jspAttr != null) { err.jspError(n, "jsp.error.duplicate.name.jspattribute", @@ -818,7 +818,7 @@ true); } else { err.jspError(n, "jsp.error.bad_attribute", - attrs.getQName(i), n.getShortName()); + attrs.getQName(i), n.getLocalName()); } } } @@ -868,7 +868,7 @@ = new Node.JspAttribute(na, true); } else { err.jspError(n, "jsp.error.bad_attribute", - na.getName(), n.getShortName()); + na.getName(), n.getLocalName()); } } } @@ -884,7 +884,7 @@ && tei.getVariableInfo(tagData).length > 0 && tagInfo.getTagVariableInfos().length > 0) { err.jspError("jsp.error.non_null_tei_and_var_subelems", - n.getName()); + n.getQName()); } n.setTagData(tagData); @@ -1139,7 +1139,7 @@ public void visit(Node.CustomTag n) throws JasperException { TagInfo tagInfo = n.getTagInfo(); if (tagInfo == null) { - err.jspError(n, "jsp.error.missing.tagInfo", n.getName()); + err.jspError(n, "jsp.error.missing.tagInfo", n.getQName()); } ValidationMessage[] errors = tagInfo.validate(n.getTagData()); @@ -1147,7 +1147,7 @@ StringBuffer errMsg = new StringBuffer(); errMsg.append("<h3>"); errMsg.append(Localizer.getMessage("jsp.error.tei.invalid.attributes", - n.getName())); + n.getQName())); errMsg.append("</h3>"); for (int i=0; i<errors.length; i++) { errMsg.append("<p>");
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]