Package org.apache.jasper.compiler
Class Compiler
- java.lang.Object
- 
- org.apache.jasper.compiler.Compiler
 
- 
- Direct Known Subclasses:
- AntCompiler,- JDTCompiler
 
 public abstract class Compiler extends java.lang.ObjectMain 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 SummaryFields Modifier and Type Field Description protected JspCompilationContextctxtprotected ErrorDispatchererrDispatcherprotected JspServletWrapperjswprotected Optionsoptionsprotected org.apache.jasper.compiler.PageInfopageInfoprotected org.apache.jasper.compiler.Node.NodespageNodesprotected org.apache.jasper.compiler.TagFileProcessortfp
 - 
Constructor SummaryConstructors Constructor Description Compiler()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcompile()Compile the jsp file from the current engine context.voidcompile(boolean compileClass)Compile the jsp file from the current engine context.voidcompile(boolean compileClass, boolean jspcMode)Compile the jsp file from the current engine context.protected abstract voidgenerateClass(java.lang.String[] smap)Servlet compilation.protected java.lang.String[]generateJava()Compile the jsp file into equivalent servlet in .java fileJspCompilationContextgetCompilationContext()ErrorDispatchergetErrorDispatcher()org.apache.jasper.compiler.PageInfogetPageInfo()org.apache.jasper.compiler.Node.NodesgetPageNodes()Retrieves the parsed nodes of the JSP page, if they are available.voidinit(JspCompilationContext ctxt, JspServletWrapper jsw)booleanisOutDated()This is a protected method intended to be overridden by subclasses of Compiler.booleanisOutDated(boolean checkClass)Determine if a compilation is necessary by checking the time stamp of the JSP page with that of the corresponding .class or .java file.voidremoveGeneratedClassFiles()voidremoveGeneratedFiles()Remove generated files
 
- 
- 
- 
Field Detail- 
ctxtprotected JspCompilationContext ctxt 
 - 
errDispatcherprotected ErrorDispatcher errDispatcher 
 - 
pageInfoprotected org.apache.jasper.compiler.PageInfo pageInfo 
 - 
jswprotected JspServletWrapper jsw 
 - 
tfpprotected org.apache.jasper.compiler.TagFileProcessor tfp 
 - 
optionsprotected Options options 
 - 
pageNodesprotected org.apache.jasper.compiler.Node.Nodes pageNodes 
 
- 
 - 
Method Detail- 
initpublic void init(JspCompilationContext ctxt, JspServletWrapper jsw) 
 - 
getPageNodespublic org.apache.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://bz.apache.org/bugzilla/show_bug.cgi?id=37062. - Returns:
- the page nodes
 
 - 
generateJavaprotected java.lang.String[] generateJava() throws java.lang.ExceptionCompile the jsp file into equivalent servlet in .java file- Returns:
- a smap for the current JSP page, if one is generated, null otherwise
- Throws:
- java.lang.Exception- Error generating Java source
 
 - 
generateClassprotected abstract void generateClass(java.lang.String[] smap) throws java.io.FileNotFoundException, JasperException, java.lang.ExceptionServlet compilation. This compiles the generated sources into Servlets.- Parameters:
- smap- The SMAP files for source debugging
- Throws:
- java.io.FileNotFoundException- Source files not found
- JasperException- Compilation error
- java.lang.Exception- Some other error
 
 - 
compilepublic void compile() throws java.io.FileNotFoundException, JasperException, java.lang.ExceptionCompile the jsp file from the current engine context.- Throws:
- java.io.FileNotFoundException- Source files not found
- JasperException- Compilation error
- java.lang.Exception- Some other error
 
 - 
compilepublic void compile(boolean compileClass) throws java.io.FileNotFoundException, JasperException, java.lang.ExceptionCompile 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:
- java.io.FileNotFoundException- Source files not found
- JasperException- Compilation error
- java.lang.Exception- Some other error
 
 - 
compilepublic void compile(boolean compileClass, boolean jspcMode) throws java.io.FileNotFoundException, JasperException, java.lang.ExceptionCompile 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:
- java.io.FileNotFoundException- Source files not found
- JasperException- Compilation error
- java.lang.Exception- Some other error
 
 - 
isOutDatedpublic boolean isOutDated() This is a protected method intended to be overridden by subclasses of Compiler. This is used by the compile method to do all the compilation.- Returns:
- trueif the source generation and compilation should occur
 
 - 
isOutDatedpublic boolean isOutDated(boolean checkClass) Determine if a compilation is necessary by checking the time stamp of the JSP page with that of the corresponding .class or .java file. If the page has dependencies, the check is also extended to its dependents, and so on. This method can by overridden by a subclasses of Compiler.- Parameters:
- checkClass- If true, check against .class file, if false, check against .java file.
- Returns:
- trueif the source generation and compilation should occur
 
 - 
getErrorDispatcherpublic ErrorDispatcher getErrorDispatcher() - Returns:
- the error dispatcher.
 
 - 
getPageInfopublic org.apache.jasper.compiler.PageInfo getPageInfo() - Returns:
- the info about the page under compilation
 
 - 
getCompilationContextpublic JspCompilationContext getCompilationContext() 
 - 
removeGeneratedFilespublic void removeGeneratedFiles() Remove generated files
 - 
removeGeneratedClassFilespublic void removeGeneratedClassFiles() 
 
- 
 
-