Package org.apache.jasper.compiler
Class Compiler
java.lang.Object
org.apache.jasper.compiler.Compiler
Main JSP compiler class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JspCompilationContext
private ErrorDispatcher
private JavaCompiler
private boolean
private boolean
private long
private JspServletWrapper
private Logger
private Options
private PageInfo
private Node.Nodes
private SmapUtil
private static String[]
private static String[]
private TagFileProcessor
-
Constructor Summary
ConstructorsConstructorDescriptionCompiler
(JspCompilationContext ctxt, JspServletWrapper jsw) Compiler
(JspCompilationContext ctxt, JspServletWrapper jsw, boolean jspcMode) -
Method Summary
Modifier and TypeMethodDescriptionvoid
compile
(boolean compileClass) Compile the jsp file from the current engine context.private void
Compile the servlet from .java file to .class fileprivate void
Compile the jsp file into equivalent servlet in java sourceprivate Class
getClassFor
(String className) Gets the error dispatcher.Gets the info about the page under compilationprivate void
Get an instance of JavaCompiler.boolean
This is a protected method intended to be overridden by subclasses of Compiler.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.void
void
Remove generated filesprivate void
void
setPageInfo
(PageInfo pageInfo) Sets the info about the page under compilationprivate boolean
systemJarInWebinf
(String path) Return true if the path refers to a jar file in WEB-INF and is a system jar.
-
Field Details
-
ctxt
-
errDispatcher
-
pageInfo
-
jsw
-
tfp
-
javaCompiler
-
log
-
jspcMode
private boolean jspcMode -
smapUtil
-
options
-
pageNodes
-
jspModTime
private long jspModTime -
javaCompilerOptionsSet
private boolean javaCompilerOptionsSet -
systemJars
-
systemJsfJars
-
-
Constructor Details
-
Compiler
-
Compiler
public Compiler(JspCompilationContext ctxt, JspServletWrapper jsw, boolean jspcMode) throws JasperException - Throws:
JasperException
-
-
Method Details
-
generateJava
Compile the jsp file into equivalent servlet in java source- Throws:
Exception
-
setJavaCompilerOptions
private void setJavaCompilerOptions() -
generateClass
Compile the servlet from .java file to .class file -
compile
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
-
isOutDated
public 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. -
isOutDated
public 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 dependeants, and so on. This method can by overidden by a subclasses of Compiler.- Parameters:
checkClass
- If true, check against .class file, if false, check against .java file.
-
getErrorDispatcher
Gets the error dispatcher. -
getPageInfo
Gets the info about the page under compilation -
setPageInfo
Sets the info about the page under compilation -
getCompilationContext
-
removeGeneratedFiles
public void removeGeneratedFiles()Remove generated files -
removeGeneratedClassFiles
public void removeGeneratedClassFiles() -
initJavaCompiler
Get an instance of JavaCompiler. If a compiler is specified in Options, use that, else if Running with JDK 6, use a Jsr199JavaCompiler that supports JSR199, else if eclipse's JDT compiler is available, use that. The default is to use javac from ant.- Throws:
JasperException
-
getClassFor
-
systemJarInWebinf
Return true if the path refers to a jar file in WEB-INF and is a system jar.
-