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 2003/05/12 00:54:48 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java JspDocumentParser.java Node.java PageDataImpl.java Validator.java
luehe 2003/05/11 15:54:48
Modified: jasper2/src/share/org/apache/jasper/compiler Generator.java
JspDocumentParser.java Node.java PageDataImpl.java
Validator.java
Log:
Fixed Bugtraq 4862140 ("'xmlns' attributes that do not represent tag
librariess are subject to TLD check")
Revision Changes Path
1.187 +23 -6 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.186
retrieving revision 1.187
diff -u -r1.186 -r1.187
--- Generator.java 7 May 2003 02:05:58 -0000 1.186
+++ Generator.java 11 May 2003 22:54:47 -0000 1.187
@@ -1572,10 +1572,27 @@
*/
out.printin("out.write(\"<");
out.print(n.getQName());
- Attributes attrs = n.getAttributes();
+
+ Attributes attrs = n.getNonTaglibXmlnsAttributes();
+ int attrsLen = (attrs == null) ? 0 : attrs.getLength();
+ for (int i=0; i<attrsLen; i++) {
+ out.print(" ");
+ out.print(attrs.getQName(i));
+ out.print("=");
+ String quote = DOUBLE_QUOTE;
+ String value = attrs.getValue(i);
+ if (value.indexOf('"') != -1) {
+ quote = SINGLE_QUOTE;
+ }
+ out.print(quote);
+ out.print(value);
+ out.print(quote);
+ }
+
+ attrs = n.getAttributes();
+ attrsLen = (attrs == null) ? 0 : attrs.getLength();
Node.JspAttribute[] jspAttrs = n.getJspAttributes();
- int attrsLength = (attrs == null) ? 0 : attrs.getLength();
- for (int i=0; i<attrsLength; i++) {
+ for (int i=0; i<attrsLen; i++) {
out.print(" ");
out.print(attrs.getQName(i));
out.print("=");
1.59 +161 -160 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.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- JspDocumentParser.java 22 Apr 2003 18:53:19 -0000 1.58
+++ JspDocumentParser.java 11 May 2003 22:54:47 -0000 1.59
@@ -209,12 +209,26 @@
/*
* Receives notification of the start of an element.
+ *
+ * This method assigns the given tag attributes to one of 3 buckets:
+ *
+ * - "xmlns" attributes that represent (standard or custom) tag libraries.
+ * - "xmlns" attributes that do not represent tag libraries.
+ * - all remaining attributes.
+ *
+ * For each "xmlns" attribute that represents a custom tag library, the
+ * corresponding TagLibraryInfo object is added to the set of custom
+ * tag libraries.
*/
public void startElement(String uri,
String localName,
String qName,
Attributes attrs) throws SAXException {
+ AttributesImpl taglibAttrs = null;
+ AttributesImpl nonTaglibAttrs = null;
+ AttributesImpl nonTaglibXmlnsAttrs = null;
+
checkPrefixes(uri, qName, attrs);
if (directivesOnly && !localName.startsWith(DIRECTIVE_ACTION)) {
@@ -231,16 +245,64 @@
Mark start = new Mark(path, locator.getLineNumber(),
locator.getColumnNumber());
- Attributes taglibAttrs = null;
- Attributes nonTaglibAttrs = null;
if (attrs != null) {
- try {
- taglibAttrs = addTagLibraries(attrs);
- nonTaglibAttrs = filterTaglibAttributes(attrs, taglibAttrs);
- } catch (JasperException je) {
- throw new SAXParseException(Localizer.getMessage(
- "jsp.error.could.not.add.taglibraries"),
- locator, je);
+ /*
+ * Notice that due to a bug in the underlying SAX parser, the
+ * attributes must be enumerated in descending order.
+ */
+ boolean isTaglib = false;
+ for (int i=attrs.getLength()-1; i>=0; i--) {
+ isTaglib = false;
+ String attrQName = attrs.getQName(i);
+ if (!attrQName.startsWith("xmlns")) {
+ if (nonTaglibAttrs == null) {
+ nonTaglibAttrs = new AttributesImpl();
+ }
+ nonTaglibAttrs.addAttribute(attrs.getURI(i),
+ attrs.getLocalName(i),
+ attrs.getQName(i),
+ attrs.getType(i),
+ attrs.getValue(i));
+ } else {
+ if (attrQName.startsWith("xmlns:jsp")) {
+ isTaglib = true;
+ } else {
+ String attrUri = attrs.getValue(i);
+ if (!taglibs.containsKey(attrUri)) {
+ TagLibraryInfo tagLibInfo = null;
+ try {
+ tagLibInfo = getTaglibInfo(attrQName, attrUri);
+ } catch (JasperException je) {
+ throw new SAXParseException(
+ Localizer.getMessage("jsp.error.could.not.add.taglibraries"),
+ locator, je);
+ }
+ if (tagLibInfo != null) {
+ isTaglib = true;
+ }
+ taglibs.put(attrUri, tagLibInfo);
+ }
+ }
+ if (isTaglib) {
+ if (taglibAttrs == null) {
+ taglibAttrs = new AttributesImpl();
+ }
+ taglibAttrs.addAttribute(attrs.getURI(i),
+ attrs.getLocalName(i),
+ attrs.getQName(i),
+ attrs.getType(i),
+ attrs.getValue(i));
+ } else {
+ if (nonTaglibXmlnsAttrs == null) {
+ nonTaglibXmlnsAttrs = new AttributesImpl();
+ }
+ nonTaglibXmlnsAttrs.addAttribute(attrs.getURI(i),
+ attrs.getLocalName(i),
+ attrs.getQName(i),
+ attrs.getType(i),
+ attrs.getValue(i));
+ }
+ }
}
}
@@ -248,14 +310,17 @@
if ("http://java.sun.com/JSP/Page".equals(uri)) {
node = parseStandardAction(qName, localName, nonTaglibAttrs,
- taglibAttrs, start, current);
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else {
node = parseCustomAction(qName, localName, uri, nonTaglibAttrs,
- taglibAttrs, start, current);
+ nonTaglibXmlnsAttrs, taglibAttrs, start,
+ current);
if (node == null) {
node = new Node.UninterpretedTag(qName, localName,
- nonTaglibAttrs, taglibAttrs,
- start, current);
+ nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs, start, current);
}
}
@@ -495,17 +560,17 @@
// Private utility methods
private Node parseStandardAction(String qName, String localName,
- Attributes attrs, Attributes xmlnsAttrs,
+ Attributes nonTaglibAttrs,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
Mark start, Node parent)
throws SAXException {
Node node = null;
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(qName, attrs, xmlnsAttrs, start, current);
+ node = new Node.JspRoot(qName, nonTaglibAttrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, current);
if (isTop) {
pageInfo.setHasJspRoot(true);
}
@@ -516,54 +581,71 @@
localName),
locator);
}
- node = new Node.PageDirective(qName, attrs, xmlnsAttrs, start,
- current);
- String imports = attrs.getValue("import");
+ node = new Node.PageDirective(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
+ String imports = nonTaglibAttrs.getValue("import");
// There can only be one 'import' attribute per page directive
if (imports != null) {
((Node.PageDirective) node).addImport(imports);
}
} else if (localName.equals(INCLUDE_DIRECTIVE_ACTION)) {
- node = new Node.IncludeDirective(qName, attrs, xmlnsAttrs, start,
- current);
- processIncludeDirective(attrs.getValue("file"), node);
+ node = new Node.IncludeDirective(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
+ processIncludeDirective(nonTaglibAttrs.getValue("file"), node);
} else if (localName.equals(DECLARATION_ACTION)) {
- node = new Node.Declaration(qName, xmlnsAttrs, start, current);
+ node = new Node.Declaration(qName, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, current);
} else if (localName.equals(SCRIPTLET_ACTION)) {
- node = new Node.Scriptlet(qName, xmlnsAttrs, start, current);
+ node = new Node.Scriptlet(qName, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(EXPRESSION_ACTION)) {
- node = new Node.Expression(qName, xmlnsAttrs, start, current);
+ node = new Node.Expression(qName, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(USE_BEAN_ACTION)) {
- node = new Node.UseBean(qName, attrs, xmlnsAttrs, start, current);
+ node = new Node.UseBean(qName, nonTaglibAttrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, current);
} else if (localName.equals(SET_PROPERTY_ACTION)) {
- node = new Node.SetProperty(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.SetProperty(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(GET_PROPERTY_ACTION)) {
- node = new Node.GetProperty(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.GetProperty(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(INCLUDE_ACTION)) {
- node = new Node.IncludeAction(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.IncludeAction(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(FORWARD_ACTION)) {
- node = new Node.ForwardAction(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.ForwardAction(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(PARAM_ACTION)) {
- node = new Node.ParamAction(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.ParamAction(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(PARAMS_ACTION)) {
- node = new Node.ParamsAction(qName, xmlnsAttrs, start, current);
+ node = new Node.ParamsAction(qName, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, current);
} else if (localName.equals(PLUGIN_ACTION)) {
- node = new Node.PlugIn(qName, attrs, xmlnsAttrs, start, current);
+ node = new Node.PlugIn(qName, nonTaglibAttrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, current);
} else if (localName.equals(TEXT_ACTION)) {
- node = new Node.JspText(qName, xmlnsAttrs, start, current);
+ node = new Node.JspText(qName, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(BODY_ACTION)) {
- node = new Node.JspBody(qName, xmlnsAttrs, start, current);
+ node = new Node.JspBody(qName, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(ATTRIBUTE_ACTION)) {
- node = new Node.NamedAttribute(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.NamedAttribute(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(OUTPUT_ACTION)) {
- node = new Node.JspOutput(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.JspOutput(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(TAG_DIRECTIVE_ACTION)) {
if (!isTagFile) {
throw new SAXParseException(
@@ -571,9 +653,10 @@
localName),
locator);
}
- node = new Node.TagDirective(qName, attrs, xmlnsAttrs, start,
- current);
- String imports = attrs.getValue("import");
+ node = new Node.TagDirective(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
+ String imports = nonTaglibAttrs.getValue("import");
// There can only be one 'import' attribute per tag directive
if (imports != null) {
((Node.TagDirective) node).addImport(imports);
@@ -585,8 +668,9 @@
localName),
locator);
}
- node = new Node.AttributeDirective(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.AttributeDirective(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs, start, current);
} else if (localName.equals(VARIABLE_DIRECTIVE_ACTION)) {
if (!isTagFile) {
throw new SAXParseException(
@@ -594,8 +678,9 @@
localName),
locator);
}
- node = new Node.VariableDirective(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.VariableDirective(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs,
+ taglibAttrs, start, current);
} else if (localName.equals(INVOKE_ACTION)) {
if (!isTagFile) {
throw new SAXParseException(
@@ -603,8 +688,9 @@
localName),
locator);
}
- node = new Node.InvokeAction(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.InvokeAction(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(DOBODY_ACTION)) {
if (!isTagFile) {
throw new SAXParseException(
@@ -612,13 +698,16 @@
localName),
locator);
}
- node = new Node.DoBodyAction(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.DoBodyAction(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(ELEMENT_ACTION)) {
- node = new Node.JspElement(qName, attrs, xmlnsAttrs, start,
- current);
+ node = new Node.JspElement(qName, nonTaglibAttrs,
+ nonTaglibXmlnsAttrs, taglibAttrs,
+ start, current);
} else if (localName.equals(FALLBACK_ACTION)) {
- node = new Node.FallBackAction(qName, xmlnsAttrs, start, current);
+ node = new Node.FallBackAction(qName, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, current);
} else {
throw new SAXParseException(
Localizer.getMessage("jsp.error.xml.badStandardAction",
@@ -630,48 +719,15 @@
}
/*
- * Filters, from the given attrs, all the attributes that are not
- * contained in taglibAttrs, and returns them.
- *
- * @param attrs The total set of attributes
- * @param taglibAttrs The set of attributes in attrs that represent a tag
- * library
- *
- * @param The set of attributes in attrs that do not represent a tag
- * library
- */
- private Attributes filterTaglibAttributes(Attributes attrs,
- Attributes taglibAttrs) {
- AttributesImpl ret = null;
-
- if (taglibAttrs == null) {
- ret = new AttributesImpl(attrs);
- } else {
- for (int i=attrs.getLength()-1; i>=0; i--) {
- if (taglibAttrs.getValue(attrs.getURI(i),
- attrs.getLocalName(i)) == null) {
- if (ret == null) {
- ret = new AttributesImpl();
- }
- ret.addAttribute(attrs.getURI(i), attrs.getLocalName(i),
- attrs.getQName(i), attrs.getType(i),
- attrs.getValue(i));
- }
- }
- }
-
- return ret;
- }
-
- /*
* Checks if the XML element with the given tag name is a custom action,
* and returns the corresponding Node object.
*/
private Node parseCustomAction(String qName,
String localName,
String uri,
- Attributes attrs,
- Attributes xmlnsAttrs,
+ Attributes nonTaglibAttrs,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
Mark start,
Node parent) throws SAXException {
@@ -707,72 +763,17 @@
Node.CustomTag ret = null;
if (tagInfo != null) {
- ret = new Node.CustomTag(qName, prefix, localName, uri, attrs,
- xmlnsAttrs, start, parent, tagInfo,
+ ret = new Node.CustomTag(qName, prefix, localName, uri,
+ nonTaglibAttrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent, tagInfo,
tagHandlerClass);
} else {
- ret = new Node.CustomTag(qName, prefix, localName, uri, attrs,
- xmlnsAttrs, start, parent, tagFileInfo);
+ ret = new Node.CustomTag(qName, prefix, localName, uri,
+ nonTaglibAttrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent, tagFileInfo);
}
return ret;
- }
-
- /*
- * Removes from the given Attributes object any xmlns attributes that
- * represent (standard or custom) tag libraries, and adds them to the
- * result.
- *
- * For each xmlns attribute representing a custom tag library, the
- * corresponding TagLibraryInfo object is added to the set of custom
- * tag libraries.
- *
- * @param attrs The Attributes which to scan for xmlns attributes
- *
- * @return The set of xmlns attributes (extracted from the given attrs)
- * representing standard or custom tag libraries, or null
- */
- private Attributes addTagLibraries(Attributes attrs)
- throws JasperException
- {
- AttributesImpl result = null;
- boolean isTaglib = false;
-
- if (attrs != null) {
- /*
- * Notice that due to a bug in the underlying SAX parser, the
- * attributes must be enumerated in descending order.
- */
- for (int i=attrs.getLength()-1; i>=0; i--) {
- isTaglib = false;
- String qName = attrs.getQName(i);
- if (!qName.startsWith("xmlns")) {
- continue;
- }
- if (qName.startsWith("xmlns:jsp")) {
- isTaglib = true;
- } else {
- String uri = attrs.getValue(i);
- if (!taglibs.containsKey(uri)) {
- TagLibraryInfo tagLibInfo = getTaglibInfo(qName, uri);
- if (tagLibInfo != null) {
- isTaglib = true;
- }
- taglibs.put(uri, tagLibInfo);
- }
- }
- if (isTaglib) {
- if (result == null) {
- result = new AttributesImpl();
- }
- result.addAttribute(attrs.getURI(i), attrs.getLocalName(i),
- attrs.getQName(i), attrs.getType(i),
- attrs.getValue(i));
- }
- }
- }
-
- return result;
}
/*
1.74 +198 -102 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.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- Node.java 7 May 2003 23:05:24 -0000 1.73
+++ Node.java 11 May 2003 22:54:47 -0000 1.74
@@ -83,7 +83,16 @@
private static final VariableInfo[] ZERO_VARIABLE_INFO = { };
protected Attributes attrs;
- protected Attributes xmlnsAttrs;
+
+ // xmlns attributes that represent tag libraries (only in XML syntax)
+ protected Attributes taglibAttrs;
+
+ /*
+ * xmlns attributes that do not represent tag libraries
+ * (only in XML syntax)
+ */
+ protected Attributes nonTaglibXmlnsAttrs;
+
protected Nodes body;
protected String text;
protected Mark startMark;
@@ -132,7 +141,7 @@
}
/**
- * Constructor.
+ * Constructor for Nodes parsed from standard syntax.
*
* @param qName The action's qualified name
* @param localName The action's local name
@@ -151,21 +160,27 @@
}
/**
- * Constructor.
+ * Constructor for Nodes parsed from XML syntax.
*
* @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 attrs The action's attributes whose name does not start with
+ * xmlns
+ * @param nonTaglibXmlnsAttrs The action's xmlns attributes that do not
+ * represent tag libraries
+ * @param taglibAttrs The action's xmlns attributes that represent tag
+ * libraries
* @param start The location of the jsp page
* @param parent The enclosing node
*/
public Node(String qName, String localName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
+ Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
+ Mark start, Node parent) {
this.qName = qName;
this.localName = localName;
this.attrs = attrs;
- this.xmlnsAttrs = xmlnsAttrs;
+ this.nonTaglibXmlnsAttrs = nonTaglibXmlnsAttrs;
+ this.taglibAttrs = taglibAttrs;
this.startMark = start;
this.isDummy = (start == null);
addToParent(parent);
@@ -198,12 +213,33 @@
return this.localName;
}
+ /*
+ * Gets this Node's attributes.
+ *
+ * In the case of a Node parsed from standard syntax, this method returns
+ * all the Node's attributes.
+ *
+ * In the case of a Node parsed from XML syntax, this method returns only
+ * those attributes whose name does not start with xmlns.
+ */
public Attributes getAttributes() {
return this.attrs;
}
- public Attributes getXmlnsAttributes() {
- return this.xmlnsAttrs;
+ /*
+ * Gets this Node's xmlns attributes that represent tag libraries
+ * (only meaningful for Nodes parsed from XML syntax)
+ */
+ public Attributes getTaglibAttributes() {
+ return this.taglibAttrs;
+ }
+
+ /*
+ * Gets this Node's xmlns attributes that do not represent tag libraries
+ * (only meaningful for Nodes parsed from XML syntax)
+ */
+ public Attributes getNonTaglibXmlnsAttributes() {
+ return this.nonTaglibXmlnsAttrs;
}
public void setAttributes(Attributes attrs) {
@@ -493,9 +529,11 @@
*/
public static class JspRoot extends Node {
- public JspRoot(String qName, Attributes attrs, Attributes xmlnsAttrs,
+ public JspRoot(String qName, Attributes attrs,
+ Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, ROOT_ACTION, attrs, xmlnsAttrs, start, parent);
+ super(qName, ROOT_ACTION, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -511,13 +549,14 @@
private Vector imports;
public PageDirective(Attributes attrs, Mark start, Node parent) {
- this(JSP_PAGE_DIRECTIVE_ACTION, attrs, null, start, parent);
+ this(JSP_PAGE_DIRECTIVE_ACTION, attrs, null, null, start, parent);
}
public PageDirective(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
- super(qName, PAGE_DIRECTIVE_ACTION, attrs, xmlnsAttrs, start,
- parent);
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, PAGE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
imports = new Vector();
}
@@ -557,14 +596,16 @@
public static class IncludeDirective extends Node {
public IncludeDirective(Attributes attrs, Mark start, Node parent) {
- this(JSP_INCLUDE_DIRECTIVE_ACTION, attrs, null, start, parent);
+ this(JSP_INCLUDE_DIRECTIVE_ACTION, attrs, null, null, start,
+ parent);
}
public IncludeDirective(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start,
Node parent) {
- super(qName, INCLUDE_DIRECTIVE_ACTION, attrs, xmlnsAttrs, start,
- parent);
+ super(qName, INCLUDE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -594,13 +635,14 @@
private Vector imports;
public TagDirective(Attributes attrs, Mark start, Node parent) {
- this(JSP_TAG_DIRECTIVE_ACTION, attrs, null, start, parent);
+ this(JSP_TAG_DIRECTIVE_ACTION, attrs, null, null, start, parent);
}
public TagDirective(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
- super(qName, TAG_DIRECTIVE_ACTION, attrs, xmlnsAttrs, start,
- parent);
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, TAG_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
imports = new Vector();
}
@@ -640,14 +682,16 @@
public static class AttributeDirective extends Node {
public AttributeDirective(Attributes attrs, Mark start, Node parent) {
- this(JSP_ATTRIBUTE_DIRECTIVE_ACTION, attrs, null, start, parent);
+ this(JSP_ATTRIBUTE_DIRECTIVE_ACTION, attrs, null, null, start,
+ parent);
}
public AttributeDirective(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start,
Node parent) {
- super(qName, ATTRIBUTE_DIRECTIVE_ACTION, attrs, xmlnsAttrs, start,
- parent);
+ super(qName, ATTRIBUTE_DIRECTIVE_ACTION, attrs,
+ nonTaglibXmlnsAttrs, taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -661,14 +705,16 @@
public static class VariableDirective extends Node {
public VariableDirective(Attributes attrs, Mark start, Node parent) {
- this(JSP_VARIABLE_DIRECTIVE_ACTION, attrs, null, start, parent);
+ this(JSP_VARIABLE_DIRECTIVE_ACTION, attrs, null, null, start,
+ parent);
}
public VariableDirective(String qName, Attributes attrs,
- Attributes xmlnsAttrs,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, VARIABLE_DIRECTIVE_ACTION, attrs, xmlnsAttrs, start,
- parent);
+ super(qName, VARIABLE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -682,12 +728,14 @@
public static class InvokeAction extends Node {
public InvokeAction(Attributes attrs, Mark start, Node parent) {
- this(JSP_INVOKE_ACTION, attrs, null, start, parent);
+ this(JSP_INVOKE_ACTION, attrs, null, null, start, parent);
}
public InvokeAction(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
- super(qName, INVOKE_ACTION, attrs, xmlnsAttrs, start, parent);
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, INVOKE_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -701,12 +749,14 @@
public static class DoBodyAction extends Node {
public DoBodyAction(Attributes attrs, Mark start, Node parent) {
- this(JSP_DOBODY_ACTION, attrs, null, start, parent);
+ this(JSP_DOBODY_ACTION, attrs, null, null, start, parent);
}
public DoBodyAction(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
- super(qName, DOBODY_ACTION, attrs, xmlnsAttrs, start, parent);
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, DOBODY_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -740,9 +790,11 @@
}
public ScriptingElement(String qName, String localName,
- Attributes xmlnsAttrs, Mark start,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start,
Node parent) {
- super(qName, localName, null, xmlnsAttrs, start, parent);
+ super(qName, localName, null, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, parent);
}
/**
@@ -775,9 +827,11 @@
parent);
}
- public Declaration(String qName, Attributes xmlnsAttrs, Mark start,
+ public Declaration(String qName, Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start,
Node parent) {
- super(qName, DECLARATION_ACTION, xmlnsAttrs, start, parent);
+ super(qName, DECLARATION_ACTION, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -796,9 +850,11 @@
parent);
}
- public Expression(String qName, Attributes xmlnsAttrs, Mark start,
+ public Expression(String qName, Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start,
Node parent) {
- super(qName, EXPRESSION_ACTION, xmlnsAttrs, start, parent);
+ super(qName, EXPRESSION_ACTION, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -815,9 +871,11 @@
super(JSP_SCRIPTLET_ACTION, SCRIPTLET_ACTION, text, start, parent);
}
- public Scriptlet(String qName, Attributes xmlnsAttrs, Mark start,
+ public Scriptlet(String qName, Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start,
Node parent) {
- super(qName, SCRIPTLET_ACTION, xmlnsAttrs, start, parent);
+ super(qName, SCRIPTLET_ACTION, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -858,12 +916,14 @@
JspAttribute value;
public ParamAction(Attributes attrs, Mark start, Node parent) {
- this(JSP_PARAM_ACTION, attrs, null, start, parent);
+ this(JSP_PARAM_ACTION, attrs, null, null, start, parent);
}
public ParamAction(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
- super(qName, PARAM_ACTION, attrs, xmlnsAttrs, start, parent);
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, PARAM_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -885,12 +945,15 @@
public static class ParamsAction extends Node {
public ParamsAction(Mark start, Node parent) {
- this(JSP_PARAMS_ACTION, null, start, parent);
+ this(JSP_PARAMS_ACTION, null, null, start, parent);
}
- public ParamsAction(String qName, Attributes xmlnsAttrs, Mark start,
- Node parent) {
- super(qName, PARAMS_ACTION, null, xmlnsAttrs, start, parent);
+ public ParamsAction(String qName,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
+ Mark start, Node parent) {
+ super(qName, PARAMS_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -904,12 +967,15 @@
public static class FallBackAction extends Node {
public FallBackAction(Mark start, Node parent) {
- this(JSP_FALLBACK_ACTION, null, start, parent);
+ this(JSP_FALLBACK_ACTION, null, null, start, parent);
}
- public FallBackAction(String qName, Attributes xmlnsAttrs, Mark start,
+ public FallBackAction(String qName,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start,
Node parent) {
- super(qName, FALLBACK_ACTION, null, xmlnsAttrs, start, parent);
+ super(qName, FALLBACK_ACTION, null, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -925,12 +991,14 @@
private JspAttribute page;
public IncludeAction(Attributes attrs, Mark start, Node parent) {
- this(JSP_INCLUDE_ACTION, attrs, null, start, parent);
+ this(JSP_INCLUDE_ACTION, attrs, null, null, start, parent);
}
public IncludeAction(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
- super(qName, INCLUDE_ACTION, attrs, xmlnsAttrs, start, parent);
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, INCLUDE_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -954,12 +1022,14 @@
private JspAttribute page;
public ForwardAction(Attributes attrs, Mark start, Node parent) {
- this(JSP_FORWARD_ACTION, attrs, null, start, parent);
+ this(JSP_FORWARD_ACTION, attrs, null, null, start, parent);
}
public ForwardAction(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
- super(qName, FORWARD_ACTION, attrs, xmlnsAttrs, start, parent);
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, FORWARD_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -981,13 +1051,14 @@
public static class GetProperty extends Node {
public GetProperty(Attributes attrs, Mark start, Node parent) {
- this(JSP_GET_PROPERTY_ACTION, attrs, null, start, parent);
+ this(JSP_GET_PROPERTY_ACTION, attrs, null, null, start, parent);
}
public GetProperty(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
- super(qName, GET_PROPERTY_ACTION, attrs, xmlnsAttrs, start,
- parent);
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, GET_PROPERTY_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -1003,12 +1074,14 @@
private JspAttribute value;
public SetProperty(Attributes attrs, Mark start, Node parent) {
- this(JSP_SET_PROPERTY_ACTION, attrs, null, start, parent);
+ this(JSP_SET_PROPERTY_ACTION, attrs, null, null, start, parent);
}
public SetProperty(String qName, Attributes attrs,
- Attributes xmlsAttrs, Mark start, Node parent) {
- super(qName, SET_PROPERTY_ACTION, attrs, xmlsAttrs, start, parent);
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, SET_PROPERTY_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -1032,12 +1105,14 @@
JspAttribute beanName;
public UseBean(Attributes attrs, Mark start, Node parent) {
- this(JSP_USE_BEAN_ACTION, attrs, null, start, parent);
+ this(JSP_USE_BEAN_ACTION, attrs, null, null, start, parent);
}
- public UseBean(String qName, Attributes attrs, Attributes xmlnsAttrs,
+ public UseBean(String qName, Attributes attrs,
+ Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, USE_BEAN_ACTION, attrs, xmlnsAttrs, start, parent);
+ super(qName, USE_BEAN_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -1062,12 +1137,14 @@
private JspAttribute height;
public PlugIn(Attributes attrs, Mark start, Node parent) {
- this(JSP_PLUGIN_ACTION, attrs, null, start, parent);
+ this(JSP_PLUGIN_ACTION, attrs, null, null, start, parent);
}
- public PlugIn(String qName, Attributes attrs, Attributes xmlnsAttrs,
+ public PlugIn(String qName, Attributes attrs,
+ Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, PLUGIN_ACTION, attrs, xmlnsAttrs, start, parent);
+ super(qName, PLUGIN_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -1099,9 +1176,12 @@
private JspAttribute[] jspAttrs;
public UninterpretedTag(String qName, String localName,
- Attributes attrs, Attributes xmlnsAttrs,
+ Attributes attrs,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, localName, attrs, xmlnsAttrs, start, parent);
+ super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -1126,12 +1206,14 @@
private JspAttribute nameAttr;
public JspElement(Attributes attrs, Mark start, Node parent) {
- this(JSP_ELEMENT_ACTION, attrs, null, start, parent);
+ this(JSP_ELEMENT_ACTION, attrs, null, null, start, parent);
}
public JspElement(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
- super(qName, ELEMENT_ACTION, attrs, xmlnsAttrs, start, parent);
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, ELEMENT_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -1166,9 +1248,12 @@
*/
public static class JspOutput extends Node {
- public JspOutput(String qName, Attributes attrs, Attributes xmlnsAttrs,
+ public JspOutput(String qName, Attributes attrs,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
Mark start, Node parent) {
- super(qName, OUTPUT_ACTION, attrs, xmlnsAttrs, start, parent);
+ super(qName, OUTPUT_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -1284,18 +1369,21 @@
public CustomTag(String qName, String prefix, String localName,
String uri, Attributes attrs, Mark start, Node parent,
TagInfo tagInfo, Class tagHandlerClass) {
- this(qName, prefix, localName, uri, attrs, null, start, parent,
- tagInfo, tagHandlerClass);
+ this(qName, prefix, localName, uri, attrs, null, null, start,
+ parent, tagInfo, tagHandlerClass);
}
/*
* Constructor for custom action implemented by tag handler.
*/
public CustomTag(String qName, String prefix, String localName,
- String uri, Attributes attrs, Attributes xmlnsAttrs,
+ String uri, Attributes attrs,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
Mark start, Node parent, TagInfo tagInfo,
Class tagHandlerClass) {
- super(qName, localName, attrs, xmlnsAttrs, start, parent);
+ super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, parent);
this.uri = uri;
this.prefix = prefix;
@@ -1322,18 +1410,21 @@
public CustomTag(String qName, String prefix, String localName,
String uri, Attributes attrs, Mark start, Node parent,
TagFileInfo tagFileInfo) {
- this(qName, prefix, localName, uri, attrs, null, start, parent,
- tagFileInfo);
+ this(qName, prefix, localName, uri, attrs, null, null, start,
+ parent, tagFileInfo);
}
/*
* Constructor for custom action implemented by tag file.
*/
public CustomTag(String qName, String prefix, String localName,
- String uri, Attributes attrs, Attributes xmlnsAttrs,
+ String uri, Attributes attrs,
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
Mark start, Node parent, TagFileInfo tagFileInfo) {
- super(qName, localName, attrs, xmlnsAttrs, start, parent);
+ super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, parent);
this.uri = uri;
this.prefix = prefix;
@@ -1662,9 +1753,10 @@
*/
public static class JspText extends Node {
- public JspText(String qName, Attributes xmlnsAttrs, Mark start,
- Node parent) {
- super(qName, TEXT_ACTION, null, xmlnsAttrs, start, parent);
+ public JspText(String qName, Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, TEXT_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, parent);
}
public void accept(Visitor v) throws JasperException {
@@ -1689,13 +1781,16 @@
private String prefix;
public NamedAttribute(Attributes attrs, Mark start, Node parent) {
- this(JSP_ATTRIBUTE_ACTION, attrs, null, start, parent);
+ this(JSP_ATTRIBUTE_ACTION, attrs, null, null, start, parent);
}
public NamedAttribute(String qName, Attributes attrs,
- Attributes xmlnsAttrs, Mark start, Node parent) {
+ Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs,
+ Mark start, Node parent) {
- super(qName, ATTRIBUTE_ACTION, attrs, xmlnsAttrs, start, parent);
+ super(qName, ATTRIBUTE_ACTION, attrs, nonTaglibXmlnsAttrs,
+ taglibAttrs, start, parent);
temporaryVariableName = JspUtil.nextTemporaryVariableName();
if( "false".equals( this.getAttributeValue( "trim" ) ) ) {
// (if null or true, leave default of true)
@@ -1789,12 +1884,13 @@
private ChildInfo childInfo;
public JspBody(Mark start, Node parent) {
- this(JSP_BODY_ACTION, null, start, parent);
+ this(JSP_BODY_ACTION, null, null, start, parent);
}
- public JspBody(String qName, Attributes xmlnsAttrs, Mark start,
- Node parent) {
- super(qName, BODY_ACTION, null, xmlnsAttrs, start, parent);
+ public JspBody(String qName, Attributes nonTaglibXmlnsAttrs,
+ Attributes taglibAttrs, Mark start, Node parent) {
+ super(qName, BODY_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs,
+ start, parent);
this.childInfo = new ChildInfo();
}
1.31 +29 -13 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.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- PageDataImpl.java 1 May 2003 16:42:12 -0000 1.30
+++ PageDataImpl.java 11 May 2003 22:54:47 -0000 1.31
@@ -204,7 +204,7 @@
}
public void visit(Node.JspRoot n) throws JasperException {
- addAttributes(n.getXmlnsAttributes());
+ addAttributes(n.getTaglibAttributes());
addAttributes(n.getAttributes());
visitBody(n);
@@ -673,18 +673,34 @@
* Appends the attributes of the given Node to the XML view.
*/
private void printAttributes(Node n) {
- Attributes attrs = n.getXmlnsAttributes();
- if (attrs != null) {
- int len = attrs.getLength();
- for (int i=0; i<len; i++) {
- String name = attrs.getQName(i);
- String value = attrs.getValue(i);
- buf.append(" ").append(name).append("=\"").append(value).append("\"\n");
- }
+
+ /*
+ * Append "xmlns" attributes that represent tag libraries
+ */
+ Attributes attrs = n.getTaglibAttributes();
+ int len = (attrs == null) ? 0 : attrs.getLength();
+ for (int i=0; i<len; i++) {
+ String name = attrs.getQName(i);
+ String value = attrs.getValue(i);
+ buf.append(" ").append(name).append("=\"").append(value).append("\"\n");
}
+ /*
+ * Append "xmlns" attributes that do not represent tag libraries
+ */
+ attrs = n.getNonTaglibXmlnsAttributes();
+ len = (attrs == null) ? 0 : attrs.getLength();
+ for (int i=0; i<len; i++) {
+ String name = attrs.getQName(i);
+ String value = attrs.getValue(i);
+ buf.append(" ").append(name).append("=\"").append(value).append("\"\n");
+ }
+
+ /*
+ * Append all other attributes
+ */
attrs = n.getAttributes();
- int len = (attrs == null) ? 0 : attrs.getLength();
+ len = (attrs == null) ? 0 : attrs.getLength();
for (int i=0; i<len; i++) {
String name = attrs.getQName(i);
String value = attrs.getValue(i);
1.107 +4 -4 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.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- Validator.java 7 May 2003 23:05:25 -0000 1.106
+++ Validator.java 11 May 2003 22:54:47 -0000 1.107
@@ -1196,7 +1196,7 @@
private String findUri(String prefix, Node n) {
for (Node p = n; p != null; p = p.getParent()) {
- Attributes attrs = p.getXmlnsAttributes();
+ Attributes attrs = p.getTaglibAttributes();
if (attrs == null) {
continue;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org