You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2003/03/31 19:54:31 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime JspRuntimeLibrary.java PageContextImpl.java
kinman 2003/03/31 09:54:31
Modified: jasper2/src/share/org/apache/jasper/compiler Generator.java
JspUtil.java Validator.java
jasper2/src/share/org/apache/jasper/runtime
JspRuntimeLibrary.java PageContextImpl.java
Log:
- Changes to use the new API for EL. Will need patch to jakarta-commons-sandbox/el.
Revision Changes Path
1.178 +21 -27 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.177
retrieving revision 1.178
diff -u -r1.177 -r1.178
--- Generator.java 28 Mar 2003 23:15:45 -0000 1.177
+++ Generator.java 31 Mar 2003 17:54:30 -0000 1.178
@@ -699,12 +699,10 @@
* @param encode true if to be URL encoded
* @param expectedType the expected type for an EL evaluation
* (ignored for attributes that aren't EL expressions)
- * @param defaultPrefix the default prefix for any EL functions
*/
private String attributeValue(Node.JspAttribute attr,
boolean encode,
- Class expectedType,
- String defaultPrefix )
+ Class expectedType)
{
String v = attr.getValue();
if (!attr.isNamedAttribute() && (v == null))
@@ -714,7 +712,7 @@
if (attr.isELInterpreterInput()) {
boolean replaceESC = v.indexOf(Constants.ESC) > 0;
v = JspUtil.interpreterCall(this.isTagFile,
- v, expectedType, defaultPrefix,
+ v, expectedType,
attr.getEL().getMapName(), false );
// XXX ESC replacement hack
if (replaceESC) {
@@ -758,8 +756,7 @@
out.print(" + \"");
out.print(URLEncoder.encode(n.getTextAttribute("name")));
out.print("=\" + ");
- out.print(attributeValue(n.getValue(), true, String.class,
- "null" ));
+ out.print(attributeValue(n.getValue(), true, String.class));
// The separator is '&' after the second use
separator = "\"&\"";
@@ -798,7 +795,7 @@
"out.write("
+ JspUtil.interpreterCall(this.isTagFile,
"${" + new String(n.getText()) + "}", String.class,
- null, n.getEL().getMapName(), false )
+ n.getEL().getMapName(), false )
+ ");");
} else {
out.printil("out.write(" +
@@ -828,7 +825,7 @@
page.getNamedAttributeNode() );
}
else {
- pageParam = attributeValue(page, false, String.class, "null");
+ pageParam = attributeValue(page, false, String.class);
}
// If any of the params have their values specified by
@@ -919,7 +916,7 @@
page.getNamedAttributeNode() );
}
else {
- pageParam = attributeValue(page, false, String.class, "null");
+ pageParam = attributeValue(page, false, String.class);
}
// If any of the params have their values specified by
@@ -999,7 +996,7 @@
out.printil("org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(" +
"pageContext.findAttribute(\"" + name + "\"), \""
+ property + "\",");
- out.print(attributeValue(value, false, null, "null"));
+ out.print(attributeValue(value, false, null));
out.println(");");
} else if (value.isELInterpreterInput()) {
// We've got to resolve the very call to the interpreter
@@ -1039,7 +1036,7 @@
out.printin("org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(" +
"pageContext.findAttribute(\"" + name + "\"), \""
+ property + "\", ");
- out.print(attributeValue(value, false, null, "null"));
+ out.print(attributeValue(value, false, null));
out.println(", null, null, false);");
}
@@ -1126,7 +1123,7 @@
}
else {
className = attributeValue(beanName, false,
- String.class, "null");
+ String.class);
}
}
else {
@@ -1226,8 +1223,8 @@
// value=\"" + ... + "\">" );
out.printil( "out.write( \"<PARAM name=\\\"" +
escape( name ) + "\\\" value=\\\"\" + " +
- attributeValue( n.getValue(), false, String.class,
- "null" ) + " + \"\\\">\" );" );
+ attributeValue( n.getValue(), false, String.class) +
+ " + \"\\\">\" );" );
out.printil("out.write(\"\\n\");");
}
else {
@@ -1235,8 +1232,8 @@
// out.print( " blah=\"" + ... + "\"" );
out.printil( "out.write( \" " + escape( name ) +
"=\\\"\" + " +
- attributeValue( n.getValue(), false, String.class,
- "null" ) + " + \"\\\"\" );" );
+ attributeValue( n.getValue(), false, String.class)+
+ " + \"\\\"\" );" );
}
n.setEndJavaLine(out.getJavaLine());
@@ -1264,8 +1261,7 @@
width.getNamedAttributeNode() );
}
else {
- widthStr = attributeValue( width, false, String.class,
- "null" );
+ widthStr = attributeValue( width, false, String.class);
}
}
@@ -1276,8 +1272,7 @@
height.getNamedAttributeNode() );
}
else {
- heightStr = attributeValue( height, false, String.class,
- "null" );
+ heightStr = attributeValue( height, false, String.class);
}
}
@@ -1623,8 +1618,7 @@
attrStr = generateNamedAttributeValue(
attrs[i].getNamedAttributeNode());
} else {
- attrStr = attributeValue(attrs[i], false, Object.class,
- "null");
+ attrStr = attributeValue(attrs[i], false, Object.class);
}
String s = " + \" " + attrs[i].getName() + "=\\\"\" + "
+ attrStr + " + \"\\\"\"";
@@ -1634,7 +1628,7 @@
// Write begin tag, using XML-style 'name' attribute as the
// element name
String elemName = attributeValue(n.getNameAttribute(), false,
- String.class, "null");
+ String.class);
out.printin("out.write(\"<\"");
out.print(" + " + elemName);
@@ -2411,7 +2405,7 @@
// run attrValue through the expression interpreter
boolean replaceESC = attrValue.indexOf(Constants.ESC) > 0;
attrValue = JspUtil.interpreterCall(this.isTagFile,
- attrValue, c[0], n.getPrefix(),
+ attrValue, c[0],
attr.getEL().getMapName(), false );
// XXX hack: Replace ESC with '$'
if (replaceESC) {
1.36 +5 -10 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.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- JspUtil.java 29 Mar 2003 01:58:50 -0000 1.35
+++ JspUtil.java 31 Mar 2003 17:54:30 -0000 1.36
@@ -507,7 +507,6 @@
* Produces a String representing a call to the EL interpreter.
* @param expression a String containing zero or more "${}" expressions
* @param expectedType the expected type of the interpreted result
- * @param defaultPrefix Default prefix, or literal "null"
* @param fnmapvar Variable pointing to a function map.
* @param XmlEscape True if the result should do XML escaping
* @return a String representing a call to the EL interpreter.
@@ -515,7 +514,6 @@
public static String interpreterCall(boolean isTagFile,
String expression,
Class expectedType,
- String defaultPrefix,
String fnmapvar,
boolean XmlEscape )
{
@@ -587,9 +585,7 @@
+ "(" + Generator.quote(expression) + ", "
+ targetType + ".class, "
+ "(PageContext)" + jspCtxt
- + ", " + fnmapvar + ", "
- + ((defaultPrefix == null) ?
- "null" : Generator.quote( defaultPrefix ))
+ + ", " + fnmapvar
+ ", " + XmlEscape
+ ")");
@@ -614,13 +610,12 @@
String expressions,
Class expectedType,
FunctionMapper functionMapper,
- String defaultPrefix,
ErrorDispatcher err)
throws JasperException {
try {
JspUtil.expressionEvaluator.parseExpression( expressions,
- expectedType, null, defaultPrefix );
+ expectedType, null );
}
catch( ELParseException e ) {
err.jspError(where, "jsp.error.invalid.expression", expressions,
1.100 +10 -19 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.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- Validator.java 27 Mar 2003 22:51:45 -0000 1.99
+++ Validator.java 31 Mar 2003 17:54:30 -0000 1.100
@@ -498,7 +498,7 @@
throwErrorIfExpression(n, "name", "jsp:param");
n.setValue(getJspAttribute("value", null, null,
n.getAttributeValue("value"),
- java.lang.String.class, null,
+ java.lang.String.class,
n, false));
visitBody(n);
}
@@ -517,7 +517,7 @@
includeActionAttrs, err);
n.setPage(getJspAttribute("page", null, null,
n.getAttributeValue("page"),
- java.lang.String.class, null, n, false));
+ java.lang.String.class, n, false));
visitBody(n);
};
@@ -526,7 +526,7 @@
forwardActionAttrs, err);
n.setPage(getJspAttribute("page", null, null,
n.getAttributeValue("page"),
- java.lang.String.class, null, n, false));
+ java.lang.String.class, n, false));
visitBody(n);
}
@@ -544,7 +544,7 @@
String value = n.getAttributeValue("value");
n.setValue(getJspAttribute("value", null, null, value,
- java.lang.Object.class, null, n, false));
+ java.lang.Object.class, n, false));
boolean valueSpecified = n.getValue() != null;
@@ -582,7 +582,7 @@
Node.JspAttribute jattr
= getJspAttribute("beanName", null, null,
n.getAttributeValue("beanName"),
- java.lang.String.class, null, n, false);
+ java.lang.String.class, n, false);
n.setBeanName(jattr);
if (className != null && jattr != null)
err.jspError(n, "jsp.error.useBean.notBoth");
@@ -621,13 +621,13 @@
Node.JspAttribute width
= getJspAttribute("width", null, null,
n.getAttributeValue("width"),
- java.lang.String.class, null, n, false);
+ java.lang.String.class, n, false);
n.setWidth( width );
Node.JspAttribute height
= getJspAttribute("height", null, null,
n.getAttributeValue("height"),
- java.lang.String.class, null, n, false);
+ java.lang.String.class, n, false);
n.setHeight( height );
visitBody(n);
@@ -662,8 +662,6 @@
}
public void visit(Node.ELExpression n) throws JasperException {
- // Currently parseExpression does not validate functions, so
- // a null FunctionMapper is passed.
if ( !pageInfo.isELIgnored() ) {
String expressions = "${" + new String(n.getText()) + "}";
ELNode.Nodes el = ELParser.parse(expressions);
@@ -674,7 +672,6 @@
java.lang.String.class, // XXX - Should template text
// always evaluate to String?
getFunctionMapper(el),
- null,
err);
n.setEL(el);
}
@@ -786,7 +783,6 @@
attrs.getLocalName(i),
attrs.getValue(i),
java.lang.String.class,
- null,
n,
false));
} else {
@@ -797,7 +793,6 @@
attrs.getLocalName(i),
attrs.getValue(i),
java.lang.Object.class,
- null,
n,
false);
}
@@ -924,7 +919,6 @@
attrs.getLocalName(i),
attrs.getValue(i),
expectedType,
- n.getPrefix(),
n,
false);
} catch (ClassNotFoundException e) {
@@ -968,7 +962,6 @@
attrs.getLocalName(i),
attrs.getValue(i),
java.lang.Object.class,
- n.getPrefix(),
n,
true);
} else {
@@ -1054,7 +1047,6 @@
String localName,
String value,
Class expectedType,
- String defaultPrefix,
Node n,
boolean dynamic)
throws JasperException {
@@ -1102,7 +1094,6 @@
value,
expectedType,
getFunctionMapper(el),
- defaultPrefix,
this.err);
1.19 +4 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java
Index: JspRuntimeLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- JspRuntimeLibrary.java 24 Mar 2003 17:35:26 -0000 1.18
+++ JspRuntimeLibrary.java 31 Mar 2003 17:54:30 -0000 1.19
@@ -681,7 +681,7 @@
method.getParameterTypes()[0],
pageContext,
functionMapper,
- null, false )
+ false )
});
} catch (Exception ex) {
throw new JasperException(ex);
1.47 +6 -10 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.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- PageContextImpl.java 4 Mar 2003 01:57:05 -0000 1.46
+++ PageContextImpl.java 31 Mar 2003 17:54:31 -0000 1.47
@@ -121,7 +121,7 @@
// The expression evaluator, for evaluating EL expressions.
private static ExpressionEvaluatorImpl elExprEval
- = new ExpressionEvaluatorImpl();
+ = new ExpressionEvaluatorImpl(true);
// The variable resolver, for evaluating EL expressions.
private VariableResolverImpl variableResolver;
@@ -720,14 +720,12 @@
* @param expectedType The expected resulting type
* @param pageContext The page context
* @param functionMap Maps prefix and name to Method
- * @param defaultPrefix Default prefix for this evaluation
* @return The result of the evaluation
*/
public static Object proprietaryEvaluate(final String expression,
final Class expectedType,
final PageContext pageContext,
final ProtectedFunctionMapper functionMap,
- final String defaultPrefix,
final boolean escape)
throws ELException
{
@@ -741,8 +739,7 @@
return elExprEval.evaluate(expression,
expectedType,
pageContext.getVariableResolver(),
- functionMap,
- defaultPrefix);
+ functionMap);
}
});
} catch( PrivilegedActionException ex ) {
@@ -753,8 +750,7 @@
retValue = elExprEval.evaluate(expression,
expectedType,
pageContext.getVariableResolver(),
- functionMap,
- defaultPrefix);
+ functionMap);
}
if (escape) {
retValue = XmlEscape(retValue.toString());
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org