java.lang.Object
org.apache.sling.scripting.jsp.jasper.compiler.Compiler
Direct Known Subclasses:
JDTCompiler

public abstract class Compiler extends Object
Main JSP compiler class. This class uses Ant for compiling.
Author:
Anil K. Vijendran, Mandar Raje, Pierre Delisle, Kin-man Chung, Remy Maucherat, Mark Roth
  • Field Details

    • log

      protected Log log
    • ctxt

      protected final JspCompilationContext ctxt
    • errDispatcher

      protected ErrorDispatcher errDispatcher
    • pageInfo

      protected PageInfo pageInfo
    • tfp

      protected org.apache.sling.scripting.jsp.jasper.compiler.TagFileProcessor tfp
    • pageNodes

      protected org.apache.sling.scripting.jsp.jasper.compiler.Node.Nodes pageNodes
  • Constructor Details

  • Method Details

    • getPageNodes

      public org.apache.sling.scripting.jsp.jasper.compiler.Node.Nodes getPageNodes()

      Retrieves the parsed nodes of the JSP page, if they are available. May return null. Used in development mode for generating detailed error messages. http://issues.apache.org/bugzilla/show_bug.cgi?id=37062.

    • generateJava

      protected String[] generateJava() throws Exception
      Compile the jsp file into equivalent servlet in .java file
      Returns:
      a smap for the current JSP page, if one is generated, null otherwise
      Throws:
      Exception
    • generateClass

      protected abstract void generateClass(String[] smap) throws FileNotFoundException, JasperException, Exception
      Compile the servlet from .java file to .class file
      Throws:
      FileNotFoundException
      JasperException
      Exception
    • compile

      public void compile() throws FileNotFoundException, JasperException, Exception
      Compile the jsp file from the current engine context
      Throws:
      FileNotFoundException
      JasperException
      Exception
    • compile

      public void compile(boolean compileClass) throws FileNotFoundException, JasperException, Exception
      Compile the jsp file from the current engine context. As an side- effect, tag files that are referenced by this page are also compiled.
      Parameters:
      compileClass - If true, generate both .java and .class file If false, generate only .java file
      Throws:
      FileNotFoundException
      JasperException
      Exception
    • compile

      public void compile(boolean compileClass, boolean jspcMode) throws FileNotFoundException, JasperException, Exception
      Compile the jsp file from the current engine context. As an side- effect, tag files that are referenced by this page are also compiled.
      Parameters:
      compileClass - If true, generate both .java and .class file If false, generate only .java file
      jspcMode - true if invoked from JspC, false otherwise
      Throws:
      FileNotFoundException
      JasperException
      Exception
    • getErrorDispatcher

      public ErrorDispatcher getErrorDispatcher()
      Gets the error dispatcher.
    • getPageInfo

      public PageInfo getPageInfo()
      Gets the info about the page under compilation
    • getCompilationContext

      public JspCompilationContext getCompilationContext()
    • removeGeneratedFiles

      public void removeGeneratedFiles()
      Remove generated files
    • removeGeneratedClassFiles

      public void removeGeneratedClassFiles()
    • clean

      public void clean()