tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime ExpressionEvaluatorImpl.java ExpressionEvaluatorManager.java JspRuntimeLibrary.java
Date Tue, 30 Jul 2002 22:41:37 GMT
luehe       2002/07/30 15:41:37

  Modified:    jasper2/src/share/org/apache/jasper/compiler Generator.java
                        JspUtil.java
               jasper2/src/share/org/apache/jasper/runtime
                        ExpressionEvaluatorImpl.java
                        ExpressionEvaluatorManager.java
                        JspRuntimeLibrary.java
  Log:
  Made changes to comply with new signature of javax.servlet.jsp.el.ExpressionEvaluator.evaluate()
  
  Revision  Changes    Path
  1.49      +40 -7     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.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- Generator.java	29 Jul 2002 23:17:49 -0000	1.48
  +++ Generator.java	30 Jul 2002 22:41:37 -0000	1.49
  @@ -410,6 +410,9 @@
           // Static data for EL function maps:
           generateELFunctionMap();
   
  +        // Static data for EL function maps:
  +	generatePrefixMap();
  +
    	// Class variable declarations
        	
   	/*
  @@ -652,6 +655,34 @@
       }
   
       /*
  +     * Generates prefix map section.
  +     * The prefix map is a map with keys containing prefixes and values being
  +     * the URI corresponding to that prefix in the taglib machinery.
  +     */
  +    private void generatePrefixMap() throws JasperException {
  +        Hashtable taglibs = pageInfo.getTagLibraries();
  +        Iterator iter = taglibs.keySet().iterator();
  +        
  +        out.printil("private static java.util.HashMap _jspx_prefix_map = null;");
  +	iter = taglibs.keySet().iterator();
  +	out.println();
  +	out.printil("static {");
  +	out.pushIndent();
  +	out.printil("_jspx_prefix_map = new java.util.HashMap();");
  +	while (iter.hasNext()) {
  +	    String key = (String) iter.next();
  +	    TagLibraryInfo tli = (TagLibraryInfo) taglibs.get(key);
  +	    out.printin("_jspx_prefix_map.put(");
  +	    out.print(quote(tli.getPrefixString()));
  +	    out.print(", ");
  +	    out.print(quote(tli.getURI()));
  +	    out.println(");");
  +        }
  +	out.popIndent();
  +	out.printil("}");
  +    }
  +
  +    /*
        * Generates the servlet constructor.
        */
       private void generateServletConstructor(String servletClassName) {
  @@ -753,7 +784,8 @@
               if (attr.isExpression() || attr.isELInterpreterInput()) {
   		if (attr.isELInterpreterInput()) {
   		    v = JspUtil.interpreterCall( attr.getValue(), 
  -                        expectedType, "_jspx_fnmap", defaultPrefix );
  +                        expectedType, "_jspx_prefix_map", "_jspx_fnmap",
  +			defaultPrefix );
   		}
   		if (encode) {
   		    return "java.net.URLEncoder.encode(" + v + ")";
  @@ -831,7 +863,7 @@
                       "out.write("
                         + JspUtil.interpreterCall(
                         "${" + new String(n.getText()) + "}", String.class,
  -                      "_jspx_fnmap", "null" )
  +                      "_jspx_prefix_map", "_jspx_fnmap", "null" )
                       + ");");
               } else {
                   out.printil("out.write(" +
  @@ -1042,7 +1074,7 @@
                       "pageContext.findAttribute(\""  + name + "\"), \""
                       + property + "\", "
                       + quote(value.getValue()) + ", "
  -                    + "pageContext, _jspx_fnmap);");
  +                    + "pageContext, _jspx_prefix_map, _jspx_fnmap);");
               } else if( value.isNamedAttribute() ) {
                   // If the value for setProperty was specified via
                   // jsp:attribute, first generate code to evaluate
  @@ -2361,7 +2393,8 @@
   		} else if (attrs[i].isELInterpreterInput()) {
                       // run attrValue through the expression interpreter
                       attrValue = JspUtil.interpreterCall( attrValue,
  -                        c[0], "_jspx_fnmap", n.getPrefix() );
  +                        c[0], "_jspx_prefix_map", "_jspx_fnmap",
  +                        n.getPrefix() );
                   } else {
   		    attrValue = convertString(
                                   c[0], attrValue, attrName,
  
  
  
  1.8       +5 -3      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JspUtil.java	25 Jul 2002 01:04:44 -0000	1.7
  +++ JspUtil.java	30 Jul 2002 22:41:37 -0000	1.8
  @@ -543,6 +543,7 @@
        */
       public static String interpreterCall(String expression,
                                            Class expectedType,
  +					 String prefixMap,
                                            String fnMap,
                                            String defaultPrefix) 
       {
  @@ -552,6 +553,7 @@
                  + "(" + Generator.quote(expression) + ", "
                  +       expectedType.getName() + ".class, "
                  +       "pageContext,"
  +               +       prefixMap + ", "
                  +       fnMap + ", "
                  +       Generator.quote( defaultPrefix ) + ")";
       }
  
  
  
  1.2       +18 -4     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExpressionEvaluatorImpl.java	16 Jul 2002 19:30:52 -0000	1.1
  +++ ExpressionEvaluatorImpl.java	30 Jul 2002 22:41:37 -0000	1.2
  @@ -60,6 +60,7 @@
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.PageContext;
   import javax.servlet.jsp.el.ExpressionEvaluator;
  +import javax.servlet.jsp.el.VariableResolver;
   import org.apache.taglibs.standard.lang.jstl.Evaluator;
   
   /**
  @@ -97,13 +98,26 @@
       public Object evaluate( String expression, 
                               Class expectedType, 
                               JspContext jspContext,
  -                            Map elFunctions,
  -                            String defaultPrefix ) 
  -       throws JspException
  +                            Map prefixMap,
  +                            Map functionMap,
  +                            String defaultURI ) 
  +	throws JspException
       {
           // XXX - Assume PageContext for now, until JSTL APIs are updated.
           // change back to JspContext later.
           return delegate.evaluate( "", expression, expectedType, null,
  -            (PageContext)jspContext, elFunctions, defaultPrefix );
  +            (PageContext)jspContext, functionMap, defaultURI );
  +    }
  +
  +    public Object evaluate( String expression, 
  +                            Class expectedType, 
  +                            VariableResolver resolver,
  +                            Map prefixMap,
  +			    Map functionMap,
  +                            String defaultURI )
  +	throws JspException
  +    {
  +	// XXX
  +	return null;
       }
   }
  
  
  
  1.2       +3 -1      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExpressionEvaluatorManager.java	16 Jul 2002 19:30:52 -0000	1.1
  +++ ExpressionEvaluatorManager.java	30 Jul 2002 22:41:37 -0000	1.2
  @@ -93,6 +93,7 @@
       public static Object evaluate( String expression, 
                                      Class expectedType, 
                                      JspContext jspContext,
  +				   Map prefixMap,
                                      Map elFunctions,
                                      String defaultPrefix ) 
              throws JspException
  @@ -103,7 +104,8 @@
   
           // delegate the call
           return (target.evaluate(
  -            expression, expectedType, jspContext, elFunctions, defaultPrefix));
  +            expression, expectedType, jspContext, prefixMap, elFunctions,
  +	    defaultPrefix));
       }
   
       /**
  
  
  
  1.3       +7 -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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JspRuntimeLibrary.java	16 Jul 2002 19:30:52 -0000	1.2
  +++ JspRuntimeLibrary.java	30 Jul 2002 22:41:37 -0000	1.3
  @@ -64,6 +64,7 @@
   
   import java.io.IOException;
   import java.util.Enumeration;
  +import java.util.Map;
   
   import java.lang.reflect.Method;
   
  @@ -531,7 +532,8 @@
   						   String prop,
   						   String expression,
   						   PageContext pageContext,
  -                                                   java.util.Map fnMap )
  +						   Map prefixMap,
  +                                                   Map fnMap )
   	throws JasperException
       {
   	try {
  @@ -541,6 +543,7 @@
   		    expression,
   		    method.getParameterTypes()[0],
   		    pageContext,
  +		    prefixMap,
                       fnMap,
                       "null" )
   	    });
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message