Package org.apache.jasper.compiler
Class Jsr199JavaCompiler
- java.lang.Object
-
- org.apache.jasper.compiler.Jsr199JavaCompiler
-
- All Implemented Interfaces:
JavaCompiler
public class Jsr199JavaCompiler extends java.lang.Object implements JavaCompiler
Invoke Java Compiler per JSR 199, using in-memory storage for both the input Java source and the generated bytecodes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classJsr199JavaCompiler.BytecodeFile
-
Field Summary
Fields Modifier and Type Field Description protected java.io.CharArrayWritercharArrayWriterprotected java.util.ArrayList<Jsr199JavaCompiler.BytecodeFile>classFilesprotected java.util.List<java.io.File>cpathprivate JspCompilationContextctxtprivate ErrorDispatchererrDispatcherprotected java.lang.StringjavaEncodingprotected java.lang.StringjavaFileNameprotected java.util.ArrayList<java.lang.String>optionsprivate JspRuntimeContextrtctxt
-
Constructor Summary
Constructors Constructor Description Jsr199JavaCompiler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JavacErrorDetail[]compile(java.lang.String className, Node.Nodes pageNodes)Start Java compilationvoiddoJavaFile(boolean keep)Remove/save the generated Java File from/to disklonggetClassLastModified()Return the time the class file was generated.protected javax.tools.JavaFileManagergetJavaFileManager(javax.tools.JavaFileManager fm)java.io.WritergetJavaWriter(java.lang.String javaFileName, java.lang.String javaEncoding)Get a Writer for the Java file.protected javax.tools.JavaFileObjectgetOutputFile(java.lang.String className, java.net.URI uri)voidinit(JspCompilationContext ctxt, ErrorDispatcher errDispatcher, boolean suppressLogging)Initializationsvoidrelease()Release resouces used in the current compilationvoidsaveClassFile(java.lang.String className, java.lang.String classFileName)Save the generated class file to disk, if not already done.voidsetClassPath(java.util.List<java.io.File> path)Java Compiler options.voidsetDebug(boolean debug)voidsetExtdirs(java.lang.String exts)voidsetSourceVM(java.lang.String sourceVM)voidsetTargetVM(java.lang.String targetVM)
-
-
-
Field Detail
-
cpath
protected java.util.List<java.io.File> cpath
-
rtctxt
private JspRuntimeContext rtctxt
-
classFiles
protected java.util.ArrayList<Jsr199JavaCompiler.BytecodeFile> classFiles
-
options
protected java.util.ArrayList<java.lang.String> options
-
charArrayWriter
protected java.io.CharArrayWriter charArrayWriter
-
ctxt
private JspCompilationContext ctxt
-
javaFileName
protected java.lang.String javaFileName
-
javaEncoding
protected java.lang.String javaEncoding
-
errDispatcher
private ErrorDispatcher errDispatcher
-
-
Method Detail
-
init
public void init(JspCompilationContext ctxt, ErrorDispatcher errDispatcher, boolean suppressLogging)
Description copied from interface:JavaCompilerInitializations- Specified by:
initin interfaceJavaCompiler
-
release
public void release()
Description copied from interface:JavaCompilerRelease resouces used in the current compilation- Specified by:
releasein interfaceJavaCompiler
-
setClassPath
public void setClassPath(java.util.List<java.io.File> path)
Description copied from interface:JavaCompilerJava Compiler options.- Specified by:
setClassPathin interfaceJavaCompiler
-
setExtdirs
public void setExtdirs(java.lang.String exts)
- Specified by:
setExtdirsin interfaceJavaCompiler
-
setSourceVM
public void setSourceVM(java.lang.String sourceVM)
- Specified by:
setSourceVMin interfaceJavaCompiler
-
setTargetVM
public void setTargetVM(java.lang.String targetVM)
- Specified by:
setTargetVMin interfaceJavaCompiler
-
saveClassFile
public void saveClassFile(java.lang.String className, java.lang.String classFileName)Description copied from interface:JavaCompilerSave the generated class file to disk, if not already done.- Specified by:
saveClassFilein interfaceJavaCompiler
-
doJavaFile
public void doJavaFile(boolean keep) throws JasperExceptionDescription copied from interface:JavaCompilerRemove/save the generated Java File from/to disk- Specified by:
doJavaFilein interfaceJavaCompiler- Throws:
JasperException
-
setDebug
public void setDebug(boolean debug)
- Specified by:
setDebugin interfaceJavaCompiler
-
getJavaWriter
public java.io.Writer getJavaWriter(java.lang.String javaFileName, java.lang.String javaEncoding)Description copied from interface:JavaCompilerGet a Writer for the Java file. The writer is used by JSP compiler. This method allows the Java compiler control where the Java file should be generated so it knows how to handle the input for java compilation accordingly.- Specified by:
getJavaWriterin interfaceJavaCompiler
-
getClassLastModified
public long getClassLastModified()
Description copied from interface:JavaCompilerReturn the time the class file was generated.- Specified by:
getClassLastModifiedin interfaceJavaCompiler
-
compile
public JavacErrorDetail[] compile(java.lang.String className, Node.Nodes pageNodes) throws JasperException
Description copied from interface:JavaCompilerStart Java compilation- Specified by:
compilein interfaceJavaCompiler- Parameters:
className- Name of the class under compilation- Throws:
JasperException
-
getOutputFile
protected javax.tools.JavaFileObject getOutputFile(java.lang.String className, java.net.URI uri)
-
getJavaFileManager
protected javax.tools.JavaFileManager getJavaFileManager(javax.tools.JavaFileManager fm)
-
-