remm        2002/05/30 22:13:13

  Modified:    jasper2/src/share/org/apache/jasper
                        EmbededServletOptions.java JspC.java Options.java
               jasper2/src/share/org/apache/jasper/compiler Compiler.java
  Log:
  - Refactoring part 3.
  - Remove outdated compiler options.
  - Add new "compiler" option, which accepts the Ant name of the compiler.
  
  Revision  Changes    Path
  1.5       +11 -41    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java
  
  Index: EmbededServletOptions.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EmbededServletOptions.java        11 May 2002 05:00:21 -0000      1.4
  +++ EmbededServletOptions.java        31 May 2002 05:13:13 -0000      1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v
 1.4 2002/05/11 05:00:21 remm Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/05/11 05:00:21 $
  + * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v
 1.5 2002/05/31 05:13:13 remm Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/05/31 05:13:13 $
    *
    * ====================================================================
    * 
  @@ -145,14 +145,9 @@
       public String classpath = null;
       
       /**
  -     * Plugin class to use to compile JSP pages.
  +     * Compiler to use.
        */
  -    public Class jspCompilerPlugin = null;
  -
  -    /**
  -     * Path of the compiler to use for compiling JSP pages.
  -     */
  -    public String jspCompilerPath = null;
  +    public String compiler = null;
   
       /**
        * Cache for the TLD locations
  @@ -244,19 +239,12 @@
       }
   
       /**
  -     * What compiler plugin should I use to compile the servlets
  -     * generated from JSP files?
  +     * Compiler to use.
        */
  -    public Class getJspCompilerPlugin() {
  -        return jspCompilerPlugin;
  +    public String getCompiler() {
  +        return compiler;
       }
   
  -    /**
  -     * Path of the compiler to use for compiling JSP pages.
  -     */
  -    public String getJspCompilerPath() {
  -        return jspCompilerPath;
  -    }
   
       public TldLocationsCache getTldLocationsCache() {
        return tldLocationsCache;
  @@ -385,33 +373,15 @@
                                     scratchDir.getAbsolutePath()
                                 }, Logger.FATAL);
                                     
  -        String jspCompilerPath = config.getInitParameter("jspCompilerPath");
  -        if (jspCompilerPath != null) {
  -            if (new File(jspCompilerPath).exists()) {
  -                this.jspCompilerPath = jspCompilerPath;
  -            } else { 
  -                Constants.message("jsp.warning.compiler.path.notfound",
  -                                  new Object[] { jspCompilerPath }, 
  -                                  Logger.FATAL);
  -            }
  -        }
  -
  -        String jspCompilerPlugin = config.getInitParameter("jspCompilerPlugin");
  -        if (jspCompilerPlugin != null) {
  -            try {
  -                this.jspCompilerPlugin = Class.forName(jspCompilerPlugin);
  -            } catch (ClassNotFoundException cnfe) {
  -                Constants.message("jsp.warning.compiler.class.notfound",
  -                                  new Object[] { jspCompilerPlugin },
  -                                  Logger.FATAL);
  -            }
  -        }
  +        this.compiler = config.getInitParameter("compiler");
   
           this.javaEncoding = config.getInitParameter("javaEncoding");
   
        // Setup the global Tag Libraries location cache for this
        // web-application.
        tldLocationsCache = new TldLocationsCache(context);
  +
       }
  +
   }
   
  
  
  
  1.5       +11 -3     
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java
  
  Index: JspC.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JspC.java 16 May 2002 00:43:15 -0000      1.4
  +++ JspC.java 31 May 2002 05:13:13 -0000      1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v 1.4 
2002/05/16 00:43:15 kinman Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/05/16 00:43:15 $
  + * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v 1.5 
2002/05/31 05:13:13 remm Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/05/31 05:13:13 $
    *
    * ====================================================================
    * 
  @@ -227,6 +227,14 @@
          // we don't compile, so this is meanlingless
           return null;
       }
  +
  +    /**
  +     * Compiler to use.
  +     */
  +    public String getCompiler() {
  +        return null;
  +    }
  +
   
       public TldLocationsCache getTldLocationsCache() {
        return tldLocationsCache;
  
  
  
  1.5       +25 -15    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java
  
  Index: Options.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Options.java      6 May 2002 04:33:15 -0000       1.4
  +++ Options.java      31 May 2002 05:13:13 -0000      1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java,v 1.4 
2002/05/06 04:33:15 glenn Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/05/06 04:33:15 $
  + * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java,v 1.5 
2002/05/31 05:13:13 remm Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/05/31 05:13:13 $
    *
    * ====================================================================
    * 
  @@ -76,74 +76,81 @@
    * @author Pierre Delisle
    */
   public interface Options {
  +
  +
       /**
        * Are we keeping generated code around?
        */
       public boolean getKeepGenerated();
  -    
  +
  +
       /**
        * Are we supporting large files?
        */
       public boolean getLargeFile();
   
  +
       /**
        * Are we supporting HTML mapped servlets?
        */
       public boolean getMappedFile();
  -    
  -    
  +
  +
       /**
        * Should errors be sent to client or thrown into stderr?
        */
       public boolean getSendErrorToClient();
    
  +
       /**
        * Should we include debug information in compiled class?
        */
       public boolean getClassDebugInfo();
   
  +
       /**
        * Background compile thread check interval in seconds
        */
       public int getCheckInterval();
   
  +
       /**
        * Is Jasper being used in development mode?
        */
       public boolean getDevelopment();
   
  +
       /**
        * JSP reloading check ?
        */
       public boolean getReloading();
   
  +
       /**
        * Class ID for use in the plugin tag when the browser is IE. 
        */
       public String getIeClassId();
  -    
  +
  +
       /**
        * What is my scratch dir?
        */
       public File getScratchDir();
   
  +
       /**
        * What classpath should I use while compiling the servlets
        * generated from JSP files?
        */
       public String getClassPath();
   
  -    /**
  -     * What compiler plugin should I use to compile the servlets
  -     * generated from JSP files?
  -     */
  -    public Class getJspCompilerPlugin();
   
       /**
  -     * Path of the compiler to use for compiling JSP pages.
  +     * Compiler to use.
        */
  -    public String getJspCompilerPath();
  -    
  +    public String getCompiler();
  +
  +
       /**
        * The cache for the location of the TLD's
        * for the various tag libraries 'exposed'
  @@ -157,9 +164,12 @@
        */
       public TldLocationsCache getTldLocationsCache();
   
  +
       /**
        * Java platform encoding to generate the JSP
        * page servlet.
        */
       public String getJavaEncoding();
  +
  +
   }
  
  
  
  1.10      +9 -16     
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Compiler.java     31 May 2002 02:53:52 -0000      1.9
  +++ Compiler.java     31 May 2002 05:13:13 -0000      1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v
 1.9 2002/05/31 02:53:52 remm Exp $
  - * $Revision: 1.9 $
  - * $Date: 2002/05/31 02:53:52 $
  + * $Header: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v
 1.10 2002/05/31 05:13:13 remm Exp $
  + * $Revision: 1.10 $
  + * $Date: 2002/05/31 05:13:13 $
    *
    * ====================================================================
    * 
  @@ -222,22 +222,15 @@
           javac.setClasspath(path);
           javac.setDebug(ctxt.getOptions().getClassDebugInfo());
           javac.setSrcdir(srcPath);
  +        javac.setOptimize(true);
  +
  +        // Set the Java compiler to use
  +        if (options.getCompiler() != null) {
  +            javac.setCompiler(options.getCompiler());
  +        }
   
           // Build includes path
           javac.setIncludes(((JspEngineContext) ctxt).getJspPath());
  -        /*
  -        String dirName = ctxt.getJspFile();
  -        int pos = dirName.lastIndexOf('/');
  -        if (pos > 0) {
  -            dirName = dirName.substring(0, pos + 1);
  -        } else {
  -            dirName = "";
  -        }
  -        String includePath = dirName + ctxt.getServletClassName() + ".java";
  -        if (includePath.startsWith("/")) {
  -            includePath = includePath.substring(1);
  -        }
  -        */
   
           // Start capturing the System.err output for this thread
           SystemLogHandler.setThread();
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to