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/compiler Generator.java JspUtil.java
Date Thu, 01 Aug 2002 18:47:28 GMT
luehe       2002/08/01 11:47:28

  Modified:    jasper2/src/share/org/apache/jasper/compiler Generator.java
                        JspUtil.java
  Log:
  more compilation error fixes for generated tag handler file
  
  Revision  Changes    Path
  1.55      +33 -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.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- Generator.java	1 Aug 2002 02:12:05 -0000	1.54
  +++ Generator.java	1 Aug 2002 18:47:28 -0000	1.55
  @@ -407,10 +407,8 @@
               out.println();
           }
           
  -        // Static data for EL function maps:
  +        // Static data for EL function and prefix maps:
           generateELFunctionMap();
  -
  -        // Static data for EL function maps:
   	generatePrefixMap();
   
    	// Class variable declarations
  @@ -736,6 +734,7 @@
   	private String parent;
   	private String simpleTagHandlerVar;
   	private boolean isSimpleTagHandler;
  +	private boolean isTagFile;
   	private ServletWriter out;
   	private MethodsBuffer methodsBuffer;
   	private FragmentHelperClass fragmentHelperClass;
  @@ -745,10 +744,12 @@
   	/**
   	 * Constructor.
   	 */
  -	public GenerateVisitor(ServletWriter out, 
  +	public GenerateVisitor(boolean isTagFile,
  +			       ServletWriter out, 
   			       MethodsBuffer methodsBuffer, 
   			       FragmentHelperClass fragmentHelperClass,
   			       TagInfo tagInfo) {
  +	    this.isTagFile = isTagFile;
   	    this.out = out;
   	    this.methodsBuffer = methodsBuffer;
   	    this.fragmentHelperClass = fragmentHelperClass;
  @@ -783,9 +784,9 @@
   
               if (attr.isExpression() || attr.isELInterpreterInput()) {
   		if (attr.isELInterpreterInput()) {
  -		    v = JspUtil.interpreterCall( attr.getValue(), 
  -                        expectedType, "_jspx_prefix_map", "_jspx_fnmap",
  -			defaultPrefix );
  +		    v = JspUtil.interpreterCall(this.isTagFile,
  +		        attr.getValue(), expectedType, "_jspx_prefix_map",
  +			"_jspx_fnmap", defaultPrefix );
   		}
   		if (encode) {
   		    return "java.net.URLEncoder.encode(" + v + ")";
  @@ -861,9 +862,9 @@
               if ( true /*isELEnabled*/ ) {
                   out.printil(
                       "out.write("
  -                      + JspUtil.interpreterCall(
  -                      "${" + new String(n.getText()) + "}", String.class,
  -                      "_jspx_prefix_map", "_jspx_fnmap", "null" )
  +		    + JspUtil.interpreterCall(this.isTagFile,
  +                        "${" + new String(n.getText()) + "}", String.class,
  +			"_jspx_prefix_map", "_jspx_fnmap", "null" )
                       + ");");
               } else {
                   out.printil("out.write(" +
  @@ -2392,8 +2393,8 @@
   		    // Do nothing
   		} else if (attrs[i].isELInterpreterInput()) {
                       // run attrValue through the expression interpreter
  -                    attrValue = JspUtil.interpreterCall( attrValue,
  -                        c[0], "_jspx_prefix_map", "_jspx_fnmap",
  +                    attrValue = JspUtil.interpreterCall(this.isTagFile,
  +                        attrValue, c[0], "_jspx_prefix_map", "_jspx_fnmap",
                           n.getPrefix() );
                   } else {
   		    attrValue = convertString(
  @@ -2729,20 +2730,21 @@
   	if (gen.ctxt.isTagFile()) {
   	    TagInfo tagInfo = gen.ctxt.getTagInfo();
   	    gen.generateTagHandlerPreamble(tagInfo);
  -	    page.visit(gen.new GenerateVisitor(out, gen.methodsBuffer, null,
  -					   tagInfo));
  +	    page.visit(gen.new GenerateVisitor(gen.ctxt.isTagFile(), out,
  +					       gen.methodsBuffer, null,
  +					       tagInfo));
   	    gen.generateTagHandlerPostamble();
  -	    return;
  -	}
  -
  -	if (gen.ctxt.getOptions().isPoolingEnabled()) {
  -	    gen.compileTagHandlerPoolList(page);
  +	} else {
  +	    if (gen.ctxt.getOptions().isPoolingEnabled()) {
  +		gen.compileTagHandlerPoolList(page);
  +	    }
  +	    gen.generatePreamble(page);
  +	    gen.fragmentHelperClass.generatePreamble();
  +	    page.visit(gen.new GenerateVisitor(gen.ctxt.isTagFile(), out,
  +					       gen.methodsBuffer, 
  +					       gen.fragmentHelperClass, null));
  +	    gen.generatePostamble(page);
   	}
  -	gen.generatePreamble(page);
  -	gen.fragmentHelperClass.generatePreamble();
  -	page.visit(gen.new GenerateVisitor(out, gen.methodsBuffer, 
  -					   gen.fragmentHelperClass, null));
  -	gen.generatePostamble(page);
       }
   
       /*
  @@ -2762,6 +2764,10 @@
   	out.pushIndent();
   	
   	// Class body begins here
  +
  +        // Static data for EL function and prefix maps:
  +        generateELFunctionMap();
  +	generatePrefixMap();
   
   	generateTagHandlerDeclarations(tagInfo);
   
  
  
  
  1.9       +12 -5     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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JspUtil.java	30 Jul 2002 22:41:37 -0000	1.8
  +++ JspUtil.java	1 Aug 2002 18:47:28 -0000	1.9
  @@ -541,18 +541,25 @@
        * @param defaultPrefix Default prefix, or literal "null"
        * @return a String representing a call to the EL interpreter.
        */
  -    public static String interpreterCall(String expression,
  +    public static String interpreterCall(boolean isTagFile,
  +					 String expression,
                                            Class expectedType,
   					 String prefixMap,
                                            String fnMap,
                                            String defaultPrefix) 
       {
  +	String jspCtxt = null;
  +	if (isTagFile)
  +	    jspCtxt = "getJspContext()";
  +	else
  +	    jspCtxt = "pageContext";
  +
           return "(" + expectedType.getName() + ") "
                  + Constants.EL_INTERPRETER_CONDUIT_CLASS + "."
                  + Constants.EL_INTERPRETER_CONDUIT_METHOD
                  + "(" + Generator.quote(expression) + ", "
                  +       expectedType.getName() + ".class, "
  -               +       "pageContext,"
  +	       +       jspCtxt + ", "
                  +       prefixMap + ", "
                  +       fnMap + ", "
                  +       Generator.quote( defaultPrefix ) + ")";
  
  
  

--
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