costin      01/04/28 14:13:37

  Modified:    src/share/org/apache/jasper Constants.java JspC.java
               src/share/org/apache/jasper/compiler
                        GetPropertyGenerator.java
                        JspParseEventListener.java
                        SetPropertyGenerator.java TagPoolGenerator.java
                        TagPoolManagerGenerator.java
  Log:
  Small hack to make the generator use a different runtime. Unless set,
  no change in behavior.
  
  Revision  Changes    Path
  1.21      +5 -2      jakarta-tomcat/src/share/org/apache/jasper/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/Constants.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Constants.java    2001/03/23 23:00:10     1.20
  +++ Constants.java    2001/04/28 21:13:36     1.21
  @@ -71,11 +71,14 @@
    * @author Harish Prabandham
    */
   public class Constants {
  +    public static String JSP_RUNTIME_PACKAGE =
  +     "org.apache.jasper.runtime";
  +
       /**
        * The base class of the generated servlets. 
        */
  -    public static final String JSP_SERVLET_BASE =
  -     "org.apache.jasper.runtime.HttpJspBase";
  +    public static String JSP_SERVLET_BASE =
  +     JSP_RUNTIME_PACKAGE + ".HttpJspBase";
   
       /**
        * _jspService is the name of the method that is called by 
  
  
  
  1.22      +7 -4      jakarta-tomcat/src/share/org/apache/jasper/JspC.java
  
  Index: JspC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- JspC.java 2001/03/02 04:51:25     1.21
  +++ JspC.java 2001/04/28 21:13:36     1.22
  @@ -1,8 +1,4 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v 1.21 
2001/03/02 04:51:25 costin Exp $
  - * $Revision: 1.21 $
  - * $Date: 2001/03/02 04:51:25 $
  - *
    * ====================================================================
    * 
    * The Apache Software License, Version 1.1
  @@ -249,6 +245,13 @@
           dieLevel = NO_DIE_LEVEL;
           die = dieLevel;
   
  +     // Hack for Runtime package
  +     String rt=System.getProperty( "jsp.runtime.package" );
  +     if( rt!=null ) {
  +         Constants.JSP_RUNTIME_PACKAGE=rt;
  +         Constants.JSP_SERVLET_BASE=rt+".HttpJspBase";
  +     }
  +     
           while ((tok = nextArg()) != null) {
               if (tok.equals(SWITCH_QUIET)) {
                   verbosityLevel = Log.WARNING;
  
  
  
  1.5       +9 -5      
jakarta-tomcat/src/share/org/apache/jasper/compiler/GetPropertyGenerator.java
  
  Index: GetPropertyGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/GetPropertyGenerator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GetPropertyGenerator.java 2001/03/09 22:26:13     1.4
  +++ GetPropertyGenerator.java 2001/04/28 21:13:36     1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/GetPropertyGenerator.java,v
 1.4 2001/03/09 22:26:13 costin Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/03/09 22:26:13 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/GetPropertyGenerator.java,v
 1.5 2001/04/28 21:13:36 costin Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/04/28 21:13:36 $
    *
    * ====================================================================
    * 
  @@ -101,12 +101,16 @@
                   java.lang.reflect.Method meth = 
JspRuntimeLibrary.getReadMethod(cls, property);
                   
                   String methodName = meth.getName();
  -             
writer.println("out.print(org.apache.jasper.runtime.JspRuntimeLibrary.toString(" +
  +             writer.println("out.print(" +
  +                            Constants.JSP_RUNTIME_PACKAGE +
  +                            ".JspRuntimeLibrary.toString(" +
                               "(((" + clsName + ")pageContext.findAttribute(" +
                                  "\"" + name + "\"))." + methodName + "())));");
            } else {
                   // Get the class name and then introspect at runtime.
  -             
writer.println("out.print(org.apache.jasper.runtime.JspRuntimeLibrary.toString(JspRuntimeLibrary."
 +
  +             writer.println("out.print(" +
  +                            Constants.JSP_RUNTIME_PACKAGE +
  +                            ".JspRuntimeLibrary.toString(JspRuntimeLibrary." +
                               "handleGetProperty(pageContext.findAttribute(" +
                               "\"" + name + "\"), \"" + property + "\")));");
            }
  
  
  
  1.28      +6 -2      
jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java
  
  Index: JspParseEventListener.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- JspParseEventListener.java        2001/03/31 22:30:38     1.27
  +++ JspParseEventListener.java        2001/04/28 21:13:36     1.28
  @@ -374,8 +374,12 @@
   
        // Use flush buffer ( which just empty JspWriterImpl buffer )
        // instead of commiting the response.
  -     writer.println("if (out instanceof org.apache.jasper.runtime.JspWriterImpl) { 
");
  -        writer.println("    
((org.apache.jasper.runtime.JspWriterImpl)out).flushBuffer();");
  +     writer.println("if (out instanceof "
  +                    + Constants.JSP_RUNTIME_PACKAGE +
  +                    ".JspWriterImpl) { ");
  +        writer.println("    ((" +
  +                    Constants.JSP_RUNTIME_PACKAGE +
  +                    ".JspWriterImpl)out).flushBuffer();");
        writer.println("}");
        writer.println("if (_jspxFactory != null) 
_jspxFactory.releasePageContext(pageContext);");
        writer.popIndent();
  
  
  
  1.7       +11 -7     
jakarta-tomcat/src/share/org/apache/jasper/compiler/SetPropertyGenerator.java
  
  Index: SetPropertyGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/SetPropertyGenerator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SetPropertyGenerator.java 2001/03/09 22:26:13     1.6
  +++ SetPropertyGenerator.java 2001/04/28 21:13:36     1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/SetPropertyGenerator.java,v
 1.6 2001/03/09 22:26:13 costin Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/03/09 22:26:13 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/SetPropertyGenerator.java,v
 1.7 2001/04/28 21:13:36 costin Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/04/28 21:13:36 $
    *
    * ====================================================================
    * 
  @@ -103,7 +103,8 @@
                }
                
                // Set all the properties using name-value pairs in the request.
  -             
writer.println("org.apache.jasper.runtime.JspRuntimeLibrary.introspect(pageContext.findAttribute("
 +
  +             writer.println(Constants.JSP_RUNTIME_PACKAGE +
  +                            
".JspRuntimeLibrary.introspect(pageContext.findAttribute(" +
                               "\"" + name + "\"), request);");         
                
            } else {
  @@ -113,7 +114,8 @@
                    // Parameter name specified. If not same as property.
                    if (param == null) param = property;
                    
  -                 
writer.println("org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(pageContext."
 +
  +                 writer.println(Constants.JSP_RUNTIME_PACKAGE +
  +                                ".JspRuntimeLibrary.introspecthelper(pageContext." +
                                   "findAttribute(\"" + name + "\"), \"" + property +
                                   "\", request.getParameter(\"" + param + "\"), " +
                                   "request, \"" + param + "\", false);");
  @@ -121,7 +123,8 @@
                    
                    // value is a constant.
                    if (!JspUtil.isExpression (value)) {
  -                     
writer.println("org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(pageContext."
 +
  +                     writer.println(Constants.JSP_RUNTIME_PACKAGE +
  +                                    
".JspRuntimeLibrary.introspecthelper(pageContext." +
                                       "findAttribute(\"" + name + "\"), \"" + 
property +
                                       "\",\"" + JspUtil.escapeQueryString(value) +
                                       "\",null,null, false);");
  @@ -129,7 +132,8 @@
                        
                        // This requires some careful handling.
                        // int, boolean, ... are not Object(s).
  -                     
writer.println("org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(pageContext."
 +
  +                     writer.println(Constants.JSP_RUNTIME_PACKAGE +
  +                                    
".JspRuntimeLibrary.handleSetProperty(pageContext." +
                                       "findAttribute(\"" + name + "\"), \"" + 
property +
                                       "\"," + JspUtil.getExpr(value) + ");");
                    }
  
  
  
  1.2       +3 -2      
jakarta-tomcat/src/share/org/apache/jasper/compiler/TagPoolGenerator.java
  
  Index: TagPoolGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagPoolGenerator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TagPoolGenerator.java     2001/03/24 06:49:29     1.1
  +++ TagPoolGenerator.java     2001/04/28 21:13:36     1.2
  @@ -60,8 +60,8 @@
   import java.util.Vector;
   import javax.servlet.jsp.tagext.TagLibraryInfo;
   import javax.servlet.jsp.tagext.TagInfo;
  +import org.apache.jasper.Constants;
   
  -
   /**
    * This class generates tag pooling related information.  Specifically,
    * it generates code to declare tag pools and to obtain tag pools
  @@ -168,7 +168,8 @@
        */
       public void generate(ServletWriter writer, Class phase) {
           if (ClassDeclarationPhase.class.isAssignableFrom(phase)) {
  -            writer.println("org.apache.jasper.runtime.TagHandlerPool " + 
poolVarName + " = null;");
  +            writer.println(Constants.JSP_RUNTIME_PACKAGE +
  +                        ".TagHandlerPool " + poolVarName + " = null;");
           } else if (InitMethodPhase.class.isAssignableFrom(phase)) {
               writer.println("if (" + TagPoolManagerGenerator.MANAGER_VARIABLE + " != 
null) {");
               writer.pushIndent();
  
  
  
  1.2       +5 -2      
jakarta-tomcat/src/share/org/apache/jasper/compiler/TagPoolManagerGenerator.java
  
  Index: TagPoolManagerGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagPoolManagerGenerator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TagPoolManagerGenerator.java      2001/03/24 06:49:29     1.1
  +++ TagPoolManagerGenerator.java      2001/04/28 21:13:36     1.2
  @@ -56,6 +56,7 @@
   package org.apache.jasper.compiler;
   
   import org.apache.jasper.runtime.TagPoolManager;
  +import org.apache.jasper.Constants;
   
   /**
    * This class generates code during the initilization phase that
  @@ -80,10 +81,12 @@
        */
       public void generate(ServletWriter writer, Class phase) {
           if (InitMethodPhase.class.isAssignableFrom(phase)) {
  -            writer.println("org.apache.jasper.runtime.TagPoolManager " + 
MANAGER_VARIABLE + " =");
  +            writer.println(Constants.JSP_RUNTIME_PACKAGE +
  +                        ".TagPoolManager " + MANAGER_VARIABLE + " =");
               writer.pushIndent();
               // 
writer.println("org.apache.jasper.runtime.TagPoolManager.getDefaultPoolManager();");
  -            writer.println("(org.apache.jasper.runtime.TagPoolManager) 
getServletContext().getAttribute(\"" +
  +            writer.println("(" + Constants.JSP_RUNTIME_PACKAGE
  +                        + ".TagPoolManager) getServletContext().getAttribute(\"" +
                   TagPoolManager.CONTEXT_ATTRIBUTE_NAME + "\");");
               writer.popIndent();
           }
  
  
  

Reply via email to