Package org.apache.jasper.compiler
Class Compiler
java.lang.Object
org.apache.jasper.compiler.Compiler
- Direct Known Subclasses:
- AntCompiler,- JDTCompiler
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 SummaryFieldsModifier and TypeFieldDescriptionprotected JspCompilationContextprotected ErrorDispatcherprotected JspServletWrapperprotected Optionsprotected org.apache.jasper.compiler.PageInfoprotected org.apache.jasper.compiler.Node.Nodesprotected org.apache.jasper.compiler.TagFileProcessor
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidcompile()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(Map<String, SmapStratum> smaps) Servlet compilation.protected Map<String,SmapStratum> Compile the jsp file into equivalent servlet in .java fileorg.apache.jasper.compiler.PageInfovoidinit(JspCompilationContext ctxt, JspServletWrapper jsw) booleanThis 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.voidvoidRemove generated files
- 
Field Details- 
ctxt
- 
errDispatcher
- 
pageInfoprotected org.apache.jasper.compiler.PageInfo pageInfo
- 
jsw
- 
tfpprotected org.apache.jasper.compiler.TagFileProcessor tfp
- 
options
- 
pageNodesprotected org.apache.jasper.compiler.Node.Nodes pageNodes
 
- 
- 
Constructor Details- 
Compilerpublic Compiler()
 
- 
- 
Method Details- 
init
- 
getSmap
- 
generateJavaCompile the jsp file into equivalent servlet in .java file- Returns:
- A map of class names to JSR 045 source maps
- Throws:
- Exception- Error generating Java source
 
- 
generateClassprotected abstract void generateClass(Map<String, SmapStratum> smaps) throws FileNotFoundException, JasperException, ExceptionServlet compilation. This compiles the generated sources into Servlets.- Parameters:
- smaps- The source maps for the class(es) generated from the source file
- Throws:
- FileNotFoundException- Source files not found
- JasperException- Compilation error
- Exception- Some other error
 
- 
compileCompile the jsp file from the current engine context.- Throws:
- FileNotFoundException- Source files not found
- JasperException- Compilation error
- Exception- Some other error
 
- 
compileCompile 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- Source files not found
- JasperException- Compilation error
- Exception- Some other error
 
- 
compilepublic 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- Source files not found
- JasperException- Compilation error
- 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
 
- 
getErrorDispatcher- Returns:
- the error dispatcher.
 
- 
getPageInfopublic org.apache.jasper.compiler.PageInfo getPageInfo()- Returns:
- the info about the page under compilation
 
- 
getCompilationContext
- 
removeGeneratedFilespublic void removeGeneratedFiles()Remove generated files
- 
removeGeneratedClassFilespublic void removeGeneratedClassFiles()
 
-