org.apache.jasper.compiler

Class Compiler

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 Summary
protected JspCompilationContextctxt
protected ErrorDispatchererrDispatcher
protected JspServletWrapperjsw
protected Loglog
protected Optionsoptions
protected PageInfopageInfo
protected Node.NodespageNodes
protected TagFileProcessortfp
Method Summary
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(String[] smap)
Compile the servlet from .java file to .class file
protected String[]generateJava()
Compile the jsp file into equivalent servlet in .java file
JspCompilationContextgetCompilationContext()
ErrorDispatchergetErrorDispatcher()
Gets the error dispatcher.
PageInfogetPageInfo()
Gets the info about the page under compilation
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

ctxt

protected JspCompilationContext ctxt

errDispatcher

protected ErrorDispatcher errDispatcher

jsw

protected JspServletWrapper jsw

log

protected Log log

options

protected Options options

pageInfo

protected PageInfo pageInfo

pageNodes

protected Node.Nodes pageNodes

tfp

protected TagFileProcessor tfp

Method Detail

compile

public void compile()
Compile the jsp file from the current engine context

compile

public void compile(boolean compileClass)
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

compile

public void compile(boolean compileClass, boolean jspcMode)
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

generateClass

protected abstract void generateClass(String[] smap)
Compile the servlet from .java file to .class file

generateJava

protected String[] generateJava()
Compile the jsp file into equivalent servlet in .java file

Returns: a smap for the current JSP page, if one is generated, null otherwise

getCompilationContext

public JspCompilationContext getCompilationContext()

getErrorDispatcher

public ErrorDispatcher getErrorDispatcher()
Gets the error dispatcher.

getPageInfo

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

getPageNodes

public 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.

init

public void init(JspCompilationContext ctxt, JspServletWrapper jsw)

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.

removeGeneratedClassFiles

public void removeGeneratedClassFiles()

removeGeneratedFiles

public void removeGeneratedFiles()
Remove generated files
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.