You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2002/08/19 18:54:17 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime ExpressionEvaluatorImpl.java ExpressionEvaluatorManager.java JspContextWrapper.java PageContextImpl.java
luehe 2002/08/19 09:54:17
Modified: jasper2/src/share/org/apache/jasper/compiler Generator.java
JspDocumentParser.java JspUtil.java Node.java
Parser.java ScriptingVariabler.java
TagConstants.java TagFileProcessor.java
TagLibraryInfoImpl.java Validator.java
jasper2/src/share/org/apache/jasper/resources
messages.properties messages_es.properties
messages_ja.properties
jasper2/src/share/org/apache/jasper/runtime
ExpressionEvaluatorImpl.java
ExpressionEvaluatorManager.java
JspContextWrapper.java PageContextImpl.java
Log:
Adpated jasper to modified JSP 2.0 APIs, including the removal of the
fragment-input directive and <fragment-attribute> and <fragment-input>
TLD elements, and addition of the <fragment> subelement to <attribute>
and <variable>.
Revision Changes Path
1.67 +25 -71 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.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- Generator.java 16 Aug 2002 23:18:54 -0000 1.66
+++ Generator.java 19 Aug 2002 16:54:16 -0000 1.67
@@ -2337,16 +2337,15 @@
// Set parent
if (!simpleTag) {
if (parent != null) {
- out.printin("if (!(");
+ out.printin("if (");
out.print(parent);
- out.println(" instanceof javax.servlet.jsp.tagext.Tag))");
+ out.println(" instanceof javax.servlet.jsp.tagext.SimpleTag)");
out.pushIndent();
out.printin(tagHandlerVar);
out.print(".setParent(");
out.print("new javax.servlet.jsp.tagext.TagAdapter(");
+ out.print("(javax.servlet.jsp.tagext.SimpleTag) ");
out.print(parent);
- out.print(", ");
- out.print("null"); // XXX
out.println("));");
out.popIndent();
out.printil("else");
@@ -2857,34 +2856,32 @@
}
TagAttributeInfo[] attrInfos = tagInfo.getAttributes();
- TagFragmentAttributeInfo[] fragAttrInfos
- = tagInfo.getFragmentAttributes();
- // Declare "normal" attributes
+ // Declare attributes
if (attrInfos != null) {
for (int i=0; i<attrInfos.length; i++) {
- out.printin("private String ");
+ out.printin("private ");
+ if (attrInfos[i].isFragment()) {
+ out.print("javax.servlet.jsp.tagext.JspFragment ");
+ } else {
+ out.print("String ");
+ }
out.print(attrInfos[i].getName());
out.println(";");
}
out.println();
}
- // Declare fragment attributes
- if (fragAttrInfos != null) {
- for (int i=0; i<fragAttrInfos.length; i++) {
- out.printin("private javax.servlet.jsp.tagext.JspFragment ");
- out.print(fragAttrInfos[i].getName());
- out.println(";");
- }
- out.println();
- }
-
- // Define getter and setter methods for "normal" attributes
+ // Define attribute getter and setter methods
if (attrInfos != null) {
for (int i=0; i<attrInfos.length; i++) {
// getter method
- out.printin("public String ");
+ out.printin("public ");
+ if (attrInfos[i].isFragment()) {
+ out.print("javax.servlet.jsp.tagext.JspFragment ");
+ } else {
+ out.print("String ");
+ }
out.print(toGetterMethod(attrInfos[i].getName()));
out.println(" {");
out.pushIndent();
@@ -2898,7 +2895,11 @@
// setter method
out.printin("public void ");
out.print(toSetterMethodName(attrInfos[i].getName()));
- out.printin("(String ");
+ if (attrInfos[i].isFragment()) {
+ out.printin("(javax.servlet.jsp.tagext.JspFragment ");
+ } else {
+ out.printin("(String ");
+ }
out.print(attrInfos[i].getName());
out.println(") {");
out.pushIndent();
@@ -2912,39 +2913,6 @@
out.println();
}
}
-
- // Define getter and setter methods for fragment attributes
- if (fragAttrInfos != null) {
- for (int i=0; i<fragAttrInfos.length; i++) {
- // getter method
- out.printin("public javax.servlet.jsp.tagext.JspFragment ");
- out.print(toGetterMethod(fragAttrInfos[i].getName()));
- out.println(" {");
- out.pushIndent();
- out.printin("return this.");
- out.print(fragAttrInfos[i].getName());
- out.println(";");
- out.popIndent();
- out.printil("}");
- out.println();
-
- // setter method
- out.printin("public void ");
- out.print(toSetterMethodName(fragAttrInfos[i].getName()));
- out.printin("(javax.servlet.jsp.tagext.JspFragment ");
- out.print(fragAttrInfos[i].getName());
- out.println(") {");
- out.pushIndent();
- out.printin("this.");
- out.print(fragAttrInfos[i].getName());
- out.print(" = ");
- out.print(fragAttrInfos[i].getName());
- out.println(";");
- out.popIndent();
- out.printil("}");
- out.println();
- }
- }
}
/*
@@ -2982,20 +2950,6 @@
if (attrInfos != null) {
for (int i=0; i<attrInfos.length; i++) {
String attrName = attrInfos[i].getName();
- out.printin("pageContext.setAttribute(");
- out.print(quote(attrName));
- out.print(", ");
- out.print(toGetterMethod(attrName));
- out.println(");");
- }
- }
-
- // fragment attributes
- TagFragmentAttributeInfo[] fragAttrInfos
- = tagInfo.getFragmentAttributes();
- if (fragAttrInfos != null) {
- for (int i=0; i<fragAttrInfos.length; i++) {
- String attrName = fragAttrInfos[i].getName();
out.printin("pageContext.setAttribute(");
out.print(quote(attrName));
out.print(", ");
1.12 +3 -10 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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- JspDocumentParser.java 31 Jul 2002 21:42:27 -0000 1.11
+++ JspDocumentParser.java 19 Aug 2002 16:54:16 -0000 1.12
@@ -257,13 +257,6 @@
locator);
}
node = new Node.VariableDirective(attrsCopy, start, current);
- } else if (qName.equals(JSP_FRAGMENT_INPUT_DIRECTIVE)) {
- if (!isTagFile) {
- throw new SAXParseException(
- err.getString("jsp.error.action.isnottagfile", qName),
- locator);
- }
- node = new Node.FragmentInputDirective(attrsCopy, start, current);
} else if (qName.equals(JSP_INVOKE)) {
if (!isTagFile) {
throw new SAXParseException(
1.11 +5 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java
Index: JspUtil.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- JspUtil.java 12 Aug 2002 22:41:04 -0000 1.10
+++ JspUtil.java 19 Aug 2002 16:54:16 -0000 1.11
@@ -622,8 +622,6 @@
* @param where the approximate location of the expressions in the JSP page
* @param expressions a string containing zero or more "${}" expressions
* @param err an error dispatcher to use
- * @param extraInfo info (such as the name of the current attribute)
- * to be included in any error messages
*/
public static void validateExpressions(Mark where,
String expressions,
@@ -639,7 +637,8 @@
} catch (javax.servlet.jsp.JspException uglyEx) {
err.jspError(where, "jsp.error.internal.evaluator_not_found");
}
- String errMsg = el.validate(expressions);
+ String errMsg = null; // XXX EL
+ // String errMsg = el.validate(expressions);
if (errMsg != null)
err.jspError(where, "jsp.error.invalid.expression", expressions,
errMsg);
1.27 +13 -61 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.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Node.java 17 Aug 2002 00:15:27 -0000 1.26
+++ Node.java 19 Aug 2002 16:54:16 -0000 1.27
@@ -407,11 +407,6 @@
*/
public static class AttributeDirective extends Node {
- /* Use to collect all the parameters to this fragment attribut
- * during parsing of the tag file.
- */
- private Vector fragmentInputs;
-
public AttributeDirective(Attributes attrs, Mark start, Node parent) {
super(attrs, start, parent);
}
@@ -419,14 +414,6 @@
public void accept(Visitor v) throws JasperException {
v.visit(this);
}
-
- public void setFragmentInputs(Vector v) {
- fragmentInputs = v;
- }
-
- public Vector getFragmentInputs() {
- return fragmentInputs;
- }
}
/**
@@ -444,20 +431,6 @@
}
/**
- * Represents a fragment-input directive
- */
- public static class FragmentInputDirective extends Node {
-
- public FragmentInputDirective(Attributes attrs, Mark start, Node parent) {
- super(attrs, start, parent);
- }
-
- public void accept(Visitor v) throws JasperException {
- v.visit(this);
- }
- }
-
- /**
* Represents a <jsp:invoke> tag file action
*/
public static class InvokeAction extends Node {
@@ -1097,37 +1070,20 @@
}
/**
- * Checks to see if the attribute or fragment attribute of the
- * given name is of type JspFragment.
+ * Checks to see if the attribute of the given name is of type
+ * JspFragment.
*/
public boolean checkIfAttributeIsJspFragment( String name ) {
boolean result = false;
- // The attribute is of type JspFragment if it appears in
- // the TagInfo Fragment Attributes list, or if it appears in the
- // Attributes list and is of the right type.
-
- TagFragmentAttributeInfo[] fragmentAttributes =
- tagInfo.getFragmentAttributes();
- for( int i = 0; i < fragmentAttributes.length; i++ ) {
- if( fragmentAttributes[i].getName().equals( name ) ) {
- result = true;
- break;
- }
- }
-
- if( !result ) {
- TagAttributeInfo[] attributes = tagInfo.getAttributes();
- for( int i = 0; i < attributes.length; i++ ) {
- if( attributes[i].getName().equals( name ) &&
- "javax.servlet.jsp.tagext.JspFragment".equals(
- attributes[i].getTypeName() ) )
- {
- result = true;
- break;
- }
- }
- }
+ TagAttributeInfo[] attributes = tagInfo.getAttributes();
+ for (int i = 0; i < attributes.length; i++) {
+ if (attributes[i].getName().equals(name) &&
+ attributes[i].isFragment()) {
+ result = true;
+ break;
+ }
+ }
return result;
}
@@ -1556,10 +1512,6 @@
}
public void visit(VariableDirective n) throws JasperException {
- doVisit(n);
- }
-
- public void visit(FragmentInputDirective n) throws JasperException {
doVisit(n);
}
1.20 +3 -22 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.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Parser.java 8 Aug 2002 20:41:02 -0000 1.19
+++ Parser.java 19 Aug 2002 16:54:16 -0000 1.20
@@ -404,7 +404,6 @@
* | 'taglib' TagLibDirective)
* | 'attribute AttributeDirective
* | 'variable VariableDirective
- * | 'fragment-input FragmentInputDirective
* S? '%>'
*/
private void parseDirective(Node parent) throws JasperException {
@@ -445,13 +444,6 @@
directive);
}
parseVariableDirective(parent);
- } else if (reader.matches("fragment-input")) {
- directive = "<%@ fragment-input";
- if (!isTagFile) {
- err.jspError(reader.mark(), "jsp.error.directive.isnottagfile",
- directive);
- }
- parseFragmentInputDirective(parent);
} else {
err.jspError(reader.mark(), "jsp.error.invalid.directive");
}
@@ -489,17 +481,6 @@
Attributes attrs = parseAttributes();
Node.VariableDirective n =
new Node.VariableDirective(attrs, start, parent);
- }
-
- /*
- * Parses a fragment input directive with the following syntax:
- * PageDirective ::= ( S Attribute)*
- */
- private void parseFragmentInputDirective(Node parent)
- throws JasperException {
- Attributes attrs = parseAttributes();
- Node.FragmentInputDirective n =
- new Node.FragmentInputDirective(attrs, start, parent);
}
/*
1.2 +5 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ScriptingVariabler.java
Index: ScriptingVariabler.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ScriptingVariabler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ScriptingVariabler.java 16 Aug 2002 23:18:54 -0000 1.1
+++ ScriptingVariabler.java 19 Aug 2002 16:54:16 -0000 1.2
@@ -133,7 +133,8 @@
if (tagVarInfos != null) {
for (int i=0; i<tagVarInfos.length; i++) {
if (tagVarInfos[i].getScope() != scope
- || !tagVarInfos[i].getDeclare()) {
+ || !tagVarInfos[i].getDeclare()
+ || tagVarInfos[i].getFragment() != null) {
continue;
}
String varName = tagVarInfos[i].getNameGiven();
1.4 +3 -5 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TagConstants.java 22 Jul 2002 23:02:55 -0000 1.3
+++ TagConstants.java 19 Aug 2002 16:54:16 -0000 1.4
@@ -104,6 +104,4 @@
= "jsp:directive.attribute";
public static final String JSP_VARIABLE_DIRECTIVE
= "jsp:directive.variable";
- public static final String JSP_FRAGMENT_INPUT_DIRECTIVE
- = "jsp:directive.fragment-input";
}
1.12 +27 -51 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java
Index: TagFileProcessor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TagFileProcessor.java 8 Aug 2002 20:41:03 -0000 1.11
+++ TagFileProcessor.java 19 Aug 2002 16:54:16 -0000 1.12
@@ -116,6 +116,7 @@
new JspUtil.ValidAttribute("variable-class"),
new JspUtil.ValidAttribute("scope"),
new JspUtil.ValidAttribute("declare"),
+ new JspUtil.ValidAttribute("fragment"),
new JspUtil.ValidAttribute("description")
};
@@ -193,19 +194,18 @@
n.getAttributeValue("fragment"));
String type = n.getAttributeValue("type");
if (fragment) {
- n.setFragmentInputs(new Vector());
fragmentAttributesMap.put(name, n);
-
if (type != null) {
err.jspError("jsp.error.fragmentwithtype");
}
} else {
if (type == null)
type = "java.lang.String";
+ }
- attributeVector.addElement(
- new TagAttributeInfo(name, required, type, rtexprvalue));
- }
+ attributeVector.addElement(
+ new TagAttributeInfo(name, required, type, rtexprvalue,
+ fragment));
}
public void visit(Node.VariableDirective n) throws JasperException {
@@ -235,30 +235,27 @@
scope = VariableInfo.AT_END;
}
}
- variableVector.addElement(
- new TagVariableInfo(nameGiven, nameFromAttribute,
- className, declare, scope));
- }
-
- public void visit(Node.FragmentInputDirective n) throws JasperException{
- JspUtil.checkAttributes("Fragment-input directive", n,
- fragmentInputDirectiveAttrs, err);
-
- String name = n.getAttributeValue("name");
String fragment = n.getAttributeValue("fragment");
- String type = n.getAttributeValue("type");
- String description = n.getAttributeValue("description");
- boolean required = JspUtil.booleanValue(n.getAttributeValue("required"));
- // Find the attribute node with matching name
- Node.AttributeDirective attributeDirective =
- (Node.AttributeDirective) fragmentAttributesMap.get(fragment);
- if (attributeDirective == null) {
- err.jspError(n, "jsp.error.nomatching.fragment", fragment);
- }
- attributeDirective.getFragmentInputs().addElement(
- new TagFragmentAttributeInfo.FragmentInput(name, type,
- description));
+ if (fragment != null) {
+ if (declareStr != null || scopeStr != null) {
+ err.jspError(n, "jsp.error.fragmentWithDeclareOrScope");
+ }
+
+ // Find the attribute node with matching name
+ Node.AttributeDirective attributeDirective =
+ (Node.AttributeDirective) fragmentAttributesMap.get(fragment);
+ if (attributeDirective == null) {
+ err.jspError(n, "jsp.error.nomatching.fragment", fragment);
+ }
+ variableVector.addElement(
+ new TagVariableInfo(nameGiven, nameFromAttribute,
+ className, declare, scope, fragment));
+ } else {
+ variableVector.addElement(
+ new TagVariableInfo(nameGiven, nameFromAttribute,
+ className, declare, scope));
+ }
}
public TagInfo getTagInfo() {
@@ -281,26 +278,6 @@
= new TagAttributeInfo[attributeVector.size()];
attributeVector.copyInto(tagAttributeInfo);
- // For each fragment attribute, construct the fragment inputs first
- TagFragmentAttributeInfo [] fragmentAttributes
- = new TagFragmentAttributeInfo[fragmentAttributesMap.size()];
- Iterator iter = fragmentAttributesMap.values().iterator();
- int i = 0;
- while (iter.hasNext()) {
- Node.AttributeDirective n = (Node.AttributeDirective)iter.next();
- TagFragmentAttributeInfo.FragmentInput[] fragmentInputs =
- new TagFragmentAttributeInfo.FragmentInput[
- n.getFragmentInputs().size()];
- n.getFragmentInputs().copyInto(fragmentInputs);
- String name = n.getAttributeValue("name");
- boolean required = JspUtil.booleanValue(
- n.getAttributeValue("required"));
-
- fragmentAttributes[i++] = new TagFragmentAttributeInfo(
- name, required, "",
- fragmentInputs);
- }
-
return new TagInfo(name,
tagclass,
bodycontent,
@@ -312,9 +289,8 @@
smallIcon,
largeIcon,
tagVariableInfos,
- fragmentAttributes,
dynamicAttributes);
- }
+ }
}
/**
1.11 +23 -88 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
Index: TagLibraryInfoImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TagLibraryInfoImpl.java 2 Aug 2002 01:19:26 -0000 1.10
+++ TagLibraryInfoImpl.java 19 Aug 2002 16:54:16 -0000 1.11
@@ -326,7 +326,6 @@
Vector attributeVector = new Vector();
Vector variableVector = new Vector();
- Vector fragmentAttributeVector = new Vector();
Iterator list = elem.findChildren();
while (list.hasNext()) {
TreeNode element = (TreeNode) list.next();
@@ -356,9 +355,6 @@
variableVector.addElement(createVariable(element));
} else if ("attribute".equals(tname)) {
attributeVector.addElement(createAttribute(element));
- } else if ("fragment-attribute".equals(tname)) {
- fragmentAttributeVector.addElement(
- createFragmentAttribute(element));
} else if ("dynamic-attributes".equals(tname)) {
dynamicAttributes = JspUtil.booleanValue(element.getBody());
} else if ("example".equals(tname)) {
@@ -378,10 +374,6 @@
= new TagVariableInfo[variableVector.size()];
variableVector.copyInto(tagVariableInfos);
- TagFragmentAttributeInfo [] fragmentAttributes
- = new TagFragmentAttributeInfo[fragmentAttributeVector.size()];
- fragmentAttributeVector.copyInto(fragmentAttributes);
-
TagExtraInfo tei = null;
if (teiclass != null && !teiclass.equals(""))
@@ -427,7 +419,6 @@
smallIcon,
largeIcon,
tagVariableInfos,
- fragmentAttributes,
dynamicAttributes);
return taginfo;
}
@@ -473,7 +464,8 @@
TagAttributeInfo createAttribute(TreeNode elem) {
String name = null;
- boolean required = false, rtexprvalue = false, reqTime = false;
+ boolean required = false, rtexprvalue = false, reqTime = false,
+ isFragment = false;
String type = null;
Iterator list = elem.findChildren();
@@ -481,9 +473,9 @@
TreeNode element = (TreeNode) list.next();
String tname = element.getName();
- if ("name".equals(tname))
+ if ("name".equals(tname)) {
name = element.getBody();
- else if ("required".equals(tname)) {
+ } else if ("required".equals(tname)) {
String s = element.getBody();
if (s != null)
required = JspUtil.booleanValue(s);
@@ -491,75 +483,15 @@
String s = element.getBody();
if (s != null)
rtexprvalue = JspUtil.booleanValue(s);
- } else if ("type".equals(tname))
- type = element.getBody();
- else if ("description".equals(tname) || // Ignored elements
- false )
- ;
- else {
- Constants.message("jsp.warning.unknown.element.in.attribute",
- new Object[] {tname},
- Logger.WARNING
- );
- }
- }
-
- return new TagAttributeInfo(name, required, type, rtexprvalue);
- }
-
- TagFragmentAttributeInfo createFragmentAttribute(TreeNode elem) {
-
- Vector fragmentInputVector = new Vector();
- String name = null;
- String description = null;
- boolean required = false;
-
- Iterator list = elem.findChildren();
- while (list.hasNext()) {
- TreeNode element = (TreeNode) list.next();
- String tname = element.getName();
-
- if ("name".equals(tname)) {
- name = element.getBody();
- } else if ("required".equals(tname)) {
- required = JspUtil.booleanValue(element.getBody());
- } else if ("fragment-input".equals(tname)) {
- fragmentInputVector.addElement(createFragmentInput(element));
- } else if ("description".equals(tname)) {
- description = element.getBody();
- } else {
- Constants.message("jsp.warning.unknown.element.in.attribute",
- new Object[] {tname},
- Logger.WARNING
- );
- }
- }
-
- TagFragmentAttributeInfo.FragmentInput[] fragmentInputs =
- new TagFragmentAttributeInfo.FragmentInput[fragmentInputVector.size()];
- fragmentInputVector.copyInto(fragmentInputs);
-
- return new TagFragmentAttributeInfo(name, required, description,
- fragmentInputs);
- }
-
- TagFragmentAttributeInfo.FragmentInput createFragmentInput(TreeNode elem) {
-
- String name = null;
- String type = null;
- String description = null;
-
- Iterator list = elem.findChildren();
- while (list.hasNext()) {
- TreeNode element = (TreeNode) list.next();
- String tname = element.getName();
-
- if ("name".equals(tname)) {
- name = element.getBody();
} else if ("type".equals(tname)) {
type = element.getBody();
- } else if ("description".equals(tname)) {
- description = element.getBody();
+ } else if ("fragment".equals(tname)) {
+ String s = element.getBody();
+ if (s != null)
+ isFragment = JspUtil.booleanValue(s);
+ } else if ("description".equals(tname) || // Ignored elements
+ false) {
+ ;
} else {
Constants.message("jsp.warning.unknown.element.in.attribute",
new Object[] {tname},
@@ -567,8 +499,9 @@
);
}
}
- return new TagFragmentAttributeInfo.FragmentInput(name, type,
- description);
+
+ return new TagAttributeInfo(name, required, type, rtexprvalue,
+ isFragment);
}
TagVariableInfo createVariable(TreeNode elem) {
@@ -577,7 +510,8 @@
String className = "java.lang.String";
boolean declare = true;
int scope = VariableInfo.NESTED;
-
+ String fragment = null;
+
Iterator list = elem.findChildren();
while (list.hasNext()) {
TreeNode element = (TreeNode) list.next();
@@ -603,8 +537,9 @@
scope = VariableInfo.AT_END;
}
}
- }
- else if ("description".equals(tname) || // Ignored elements
+ } else if ("fragment".equals(tname)) {
+ fragment = element.getBody();
+ } else if ("description".equals(tname) || // Ignored elements
false ) {
} else {
Constants.message("jsp.warning.unknown.element.in.variable",
@@ -613,7 +548,7 @@
}
}
return new TagVariableInfo(nameGiven, nameFromAttribute,
- className, declare, scope);
+ className, declare, scope, fragment);
}
private TagLibraryValidator createValidator(TreeNode elem) {
1.21 +4 -28 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.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Validator.java 8 Aug 2002 20:41:03 -0000 1.20
+++ Validator.java 19 Aug 2002 16:54:16 -0000 1.21
@@ -67,7 +67,6 @@
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagInfo;
import javax.servlet.jsp.tagext.TagAttributeInfo;
-import javax.servlet.jsp.tagext.TagFragmentAttributeInfo;
import javax.servlet.jsp.tagext.TagLibraryInfo;
import javax.servlet.jsp.tagext.TagLibraryInfo;
import javax.servlet.jsp.tagext.ValidationMessage;
@@ -289,13 +288,6 @@
// validated by TagFileProcessor when it created a TagInfo object
// from the tag file in which the directive appeared
}
-
- public void visit(Node.FragmentInputDirective n)
- throws JasperException {
- // Do nothing, since this fragment-input directive has already been
- // validated by TagFileProcessor when it created a TagInfo object
- // from the tag file in which the directive appeared
- }
}
/**
@@ -601,10 +593,10 @@
* Make sure there are no invalid attributes
*/
Node.Nodes namedAttributeNodes = n.getNamedAttributeNodes();
- Hashtable tagDataAttrs = new Hashtable(attrs.getLength());
Node.JspAttribute[] jspAttrs
= new Node.JspAttribute[attrs.getLength()
+ namedAttributeNodes.size()];
+ Hashtable tagDataAttrs = new Hashtable(attrs.getLength());
for (int i=0; i<attrs.getLength(); i++) {
boolean found = false;
for (int j=0; j<tldAttrs.length; j++) {
@@ -656,7 +648,6 @@
/*
* Make sure there are no invalid named attributes
*/
- TagFragmentAttributeInfo[] tfais = tagInfo.getFragmentAttributes();
for (int i=0; i<namedAttributeNodes.size(); i++) {
Node.NamedAttribute na =
(Node.NamedAttribute)namedAttributeNodes.getNode( i );
@@ -676,21 +667,6 @@
TagData.REQUEST_TIME_VALUE);
found = true;
break;
- }
- }
- if (!found && (tfais != null)) {
- // check given named attribute against attributes of type
- // JspFragment
- for (int j=0; j<tfais.length; j++) {
- if (na.getName().equals(tfais[j].getName())) {
- jspAttrs[attrs.getLength() + i]
- = getJspAttribute(na.getName(), null, null,
- null, n, false);
- tagDataAttrs.put(na.getName(),
- TagData.REQUEST_TIME_VALUE);
- found = true;
- break;
- }
}
}
if (!found) {
1.23 +3 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties
Index: messages.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- messages.properties 8 Aug 2002 20:41:03 -0000 1.22
+++ messages.properties 19 Aug 2002 16:54:16 -0000 1.23
@@ -281,4 +281,5 @@
jsp.error.attribute.noquote=quote symbol expected
jsp.error.attribute.unterminated=attribute for {0} is not properly terminated
jsp.error.missing.tagInfo=TagInfo object for {0} is missing from TLD
-jsp.error.fragmentwithtype=Both fragment and type attribute specified in a tag directive
+jsp.error.fragmentwithtype=Both 'fragment' and 'type' attributes specified in tag directive
+jsp.error.fragmentWithDeclareOrScope=Both 'fragment' and 'declare' or 'scope' attributes specified in variable directive
1.6 +4 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_es.properties
Index: messages_es.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_es.properties,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- messages_es.properties 1 Aug 2002 21:17:58 -0000 1.5
+++ messages_es.properties 19 Aug 2002 16:54:16 -0000 1.6
@@ -210,3 +210,6 @@
jsp.error.usebean.notinsamefile=El tag useBean debe empezar y acabar en el mismo archivo fisico
jsp.error.invalid.attribute=
jsp.error.taglibDirective.missing.location=
+jsp.error.fragmentwithtype=
+jsp.error.fragmentWithDeclareOrScope=
+
1.5 +3 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_ja.properties
Index: messages_ja.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_ja.properties,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- messages_ja.properties 1 Aug 2002 21:17:58 -0000 1.4
+++ messages_ja.properties 19 Aug 2002 16:54:16 -0000 1.5
@@ -242,3 +242,5 @@
jsp.error.multiple.line.number=\n\nJPS\u30d5\u30a1\u30a4\u30eb: {2}\u306e\u4e2d\u306e{0}\u884c\u76ee\u3068{1}\u884c\u76ee\u306e\u9593\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\n\n
jsp.error.corresponding.servlet=\u751f\u6210\u3055\u308c\u305f\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u306e\u30a8\u30e9\u30fc\u3067\u3059:\n
jsp.error.taglibDirective.missing.location=
+jsp.error.fragmentwithtype=
+jsp.error.fragmentWithDeclareOrScope=
1.3 +15 -15 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/ExpressionEvaluatorImpl.java
Index: ExpressionEvaluatorImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/ExpressionEvaluatorImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExpressionEvaluatorImpl.java 30 Jul 2002 22:41:37 -0000 1.2
+++ ExpressionEvaluatorImpl.java 19 Aug 2002 16:54:17 -0000 1.3
@@ -56,11 +56,8 @@
package org.apache.jasper.runtime;
import java.util.Map;
-import javax.servlet.jsp.JspContext;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.PageContext;
-import javax.servlet.jsp.el.ExpressionEvaluator;
-import javax.servlet.jsp.el.VariableResolver;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.el.*;
import org.apache.taglibs.standard.lang.jstl.Evaluator;
/**
@@ -109,15 +106,18 @@
(PageContext)jspContext, functionMap, defaultURI );
}
- public Object evaluate( String expression,
- Class expectedType,
- VariableResolver resolver,
- Map prefixMap,
- Map functionMap,
- String defaultURI )
- throws JspException
- {
- // XXX
- return null;
+ public Object evaluate(String expression,
+ Class expectedType,
+ VariableResolver vResolver,
+ FunctionMapper fMapper,
+ String defaultPrefix) throws ELException {
+ return null; // XXX EL
+ }
+
+ public Expression parseExpression(String expression,
+ Class expectedType,
+ FunctionMapper fMapper,
+ String defaultPrefix) throws ELException {
+ return null; // XXX EL
}
}
1.3 +13 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/ExpressionEvaluatorManager.java
Index: ExpressionEvaluatorManager.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/ExpressionEvaluatorManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExpressionEvaluatorManager.java 30 Jul 2002 22:41:37 -0000 1.2
+++ ExpressionEvaluatorManager.java 19 Aug 2002 16:54:17 -0000 1.3
@@ -96,16 +96,25 @@
Map prefixMap,
Map elFunctions,
String defaultPrefix )
- throws JspException
+ throws JspException // XXX EL (should throw ELException)
{
// the evaluator we'll use
ExpressionEvaluator target = getEvaluatorByName(EVALUATOR_CLASS);
// delegate the call
- return (target.evaluate(
- expression, expectedType, jspContext, prefixMap, elFunctions,
- defaultPrefix));
+ Object ret = null;
+ try {
+ ret = (target.evaluate(expression,
+ expectedType,
+ jspContext.getVariableResolver(),
+ null, // XXX EL (FunctionMapper)
+ defaultPrefix));
+ } catch (ELException ele) {
+ throw new JspException(ele);
+ }
+
+ return ret;
}
/**
1.2 +13 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspContextWrapper.java
Index: JspContextWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspContextWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JspContextWrapper.java 12 Aug 2002 22:55:39 -0000 1.1
+++ JspContextWrapper.java 19 Aug 2002 16:54:17 -0000 1.2
@@ -80,6 +80,7 @@
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.el.ExpressionEvaluator;
+import javax.servlet.jsp.el.VariableResolver;
/**
* A wrapper class for PageContext class used for providing a tempory
@@ -212,6 +213,15 @@
throws ServletException, IOException
{
pageContext.include(relativeUrlPath);
+ }
+
+ public void include(String relativeUrlPath, boolean flush)
+ throws ServletException, IOException {
+ include(relativeUrlPath, false); // XXX
+ }
+
+ public VariableResolver getVariableResolver() {
+ return null; // XXX
}
public BodyContent pushBody() {
1.16 +13 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java
Index: PageContextImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- PageContextImpl.java 12 Aug 2002 17:55:45 -0000 1.15
+++ PageContextImpl.java 19 Aug 2002 16:54:17 -0000 1.16
@@ -88,6 +88,7 @@
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.el.ExpressionEvaluator;
+import javax.servlet.jsp.el.VariableResolver;
import org.apache.jasper.Constants;
import org.apache.jasper.logging.Logger;
@@ -404,6 +405,15 @@
context.getRequestDispatcher(path).include(
request, new ServletResponseWrapperInclude(response, out));
*/
+ }
+
+ public void include(String relativeUrlPath, boolean flush)
+ throws ServletException, IOException {
+ include(relativeUrlPath, false); // XXX
+ }
+
+ public VariableResolver getVariableResolver() {
+ return null; // XXX
}
public void forward(String relativeUrlPath)
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>