JSPTemplates

org.tp23.jasper
Class JspEngineContext

java.lang.Object
  |
  +--org.tp23.jasper.JspEngineContext
All Implemented Interfaces:
JspCompilationContext

public class JspEngineContext
extends java.lang.Object
implements JspCompilationContext

A place holder for various things that are used through out the JSP engine. This is a per-request/per-context data structure. Some of the instance variables are set at different points. JspLoader creates this object and passes this off to the "compiler" subsystem, which then initializes the rest of the variables.

Author:
Anil K. Vijendran, Harish Prabandham, Paul Hinds

Constructor Summary
JspEngineContext(JasperLoader loader, java.lang.String classpath, javax.servlet.ServletContext context, java.lang.String jspFile, boolean isErrPage, Options options, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
           
 
Method Summary
 void addJar(java.lang.String jar)
          Add a jar to the classpath used by the loader
 Compiler createCompiler()
          Create a "Compiler" object based on some init param data.
 java.lang.ClassLoader getClassLoader()
          What class loader to use for loading classes while compiling this JSP? I don't think this is used right now -- akv.
 java.lang.String getClassPath()
          The classpath that is passed off to the Java compiler.
 java.lang.String getContentType()
          What's the content type of this JSP? Content type includes content type and encoding.
 java.lang.String getFullClassName()
          Utility method to get the full class name from the package and class name.
 java.lang.String getJspFile()
          Path of the JSP URI.
 Options getOptions()
          Get hold of the Options object for this context.
 java.lang.String getOutputDir()
          What is the scratch directory we are generating code into? FIXME: In some places this is called scratchDir and in some other places it is called outputDir.
 JspReader getReader()
          Get the input reader for the JSP text.
 java.lang.String getRealPath(java.lang.String path)
          Gets the actual path of a URI relative to the context of the compilation.
 javax.servlet.http.HttpServletRequest getRequest()
          Get the http request we are servicing now...
 java.io.InputStream getResourceAsStream(java.lang.String res)
          Gets a resource as a stream, relative to the meanings of this context's implementation.
 javax.servlet.http.HttpServletResponse getResponse()
          Get the http response we are using now...
 java.lang.String getServletClassName()
          Just the class name (does not include package name) of the generated class.
 javax.servlet.ServletContext getServletContext()
          Get the ServletContext for the JSP we're processing now.
 java.lang.String getServletJavaFileName()
          Full path name of the Java file into which the servlet is being generated.
 java.lang.String getServletPackageName()
          The package name into which the servlet class is generated.
 ServletWriter getWriter()
          Where is the servlet being generated?
 boolean isErrorPage()
          Are we processing something that has been declared as an errorpage?
 boolean keepGenerated()
          Are we keeping generated code around?
 java.lang.String resolveRelativeUri(java.lang.String uri)
          Get the full value of a URI relative to this compilations context
 void setContentType(java.lang.String contentType)
           
 void setErrorPage(boolean isErrPage)
           
 void setReader(JspReader reader)
           
 void setServletClassName(java.lang.String servletClassName)
           
 void setServletJavaFileName(java.lang.String servletJavaFileName)
           
 void setServletPackageName(java.lang.String servletPackageName)
           
 void setWriter(ServletWriter writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JspEngineContext

public JspEngineContext(JasperLoader loader,
                        java.lang.String classpath,
                        javax.servlet.ServletContext context,
                        java.lang.String jspFile,
                        boolean isErrPage,
                        Options options,
                        javax.servlet.http.HttpServletRequest req,
                        javax.servlet.http.HttpServletResponse res)
Method Detail

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Get the http request we are servicing now...

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Get the http response we are using now...

getClassPath

public java.lang.String getClassPath()
The classpath that is passed off to the Java compiler.
Specified by:
getClassPath in interface JspCompilationContext

getReader

public JspReader getReader()
Get the input reader for the JSP text.
Specified by:
getReader in interface JspCompilationContext

getWriter

public ServletWriter getWriter()
Where is the servlet being generated?
Specified by:
getWriter in interface JspCompilationContext

getServletContext

public javax.servlet.ServletContext getServletContext()
Get the ServletContext for the JSP we're processing now.

getClassLoader

public java.lang.ClassLoader getClassLoader()
What class loader to use for loading classes while compiling this JSP? I don't think this is used right now -- akv.
Specified by:
getClassLoader in interface JspCompilationContext

addJar

public void addJar(java.lang.String jar)
            throws java.io.IOException
Description copied from interface: JspCompilationContext
Add a jar to the classpath used by the loader
Specified by:
addJar in interface JspCompilationContext

isErrorPage

public boolean isErrorPage()
Are we processing something that has been declared as an errorpage?
Specified by:
isErrorPage in interface JspCompilationContext

getOutputDir

public java.lang.String getOutputDir()
What is the scratch directory we are generating code into? FIXME: In some places this is called scratchDir and in some other places it is called outputDir.
Specified by:
getOutputDir in interface JspCompilationContext

getJspFile

public java.lang.String getJspFile()
Path of the JSP URI. Note that this is not a file name. This is the context rooted URI of the JSP file.
Specified by:
getJspFile in interface JspCompilationContext

getServletClassName

public java.lang.String getServletClassName()
Just the class name (does not include package name) of the generated class.
Specified by:
getServletClassName in interface JspCompilationContext

getServletPackageName

public java.lang.String getServletPackageName()
The package name into which the servlet class is generated.
Specified by:
getServletPackageName in interface JspCompilationContext

getFullClassName

public final java.lang.String getFullClassName()
Utility method to get the full class name from the package and class name.
Specified by:
getFullClassName in interface JspCompilationContext

getServletJavaFileName

public java.lang.String getServletJavaFileName()
Full path name of the Java file into which the servlet is being generated.
Specified by:
getServletJavaFileName in interface JspCompilationContext

keepGenerated

public boolean keepGenerated()
Are we keeping generated code around?
Specified by:
keepGenerated in interface JspCompilationContext

getContentType

public java.lang.String getContentType()
What's the content type of this JSP? Content type includes content type and encoding.
Specified by:
getContentType in interface JspCompilationContext

getOptions

public Options getOptions()
Get hold of the Options object for this context.
Specified by:
getOptions in interface JspCompilationContext

setContentType

public void setContentType(java.lang.String contentType)
Specified by:
setContentType in interface JspCompilationContext

setReader

public void setReader(JspReader reader)
Specified by:
setReader in interface JspCompilationContext

setWriter

public void setWriter(ServletWriter writer)
Specified by:
setWriter in interface JspCompilationContext

setServletClassName

public void setServletClassName(java.lang.String servletClassName)
Specified by:
setServletClassName in interface JspCompilationContext

setServletPackageName

public void setServletPackageName(java.lang.String servletPackageName)
Specified by:
setServletPackageName in interface JspCompilationContext

setServletJavaFileName

public void setServletJavaFileName(java.lang.String servletJavaFileName)
Specified by:
setServletJavaFileName in interface JspCompilationContext

setErrorPage

public void setErrorPage(boolean isErrPage)
Specified by:
setErrorPage in interface JspCompilationContext

createCompiler

public Compiler createCompiler()
                        throws JasperException
Create a "Compiler" object based on some init param data. If jspCompilerPlugin is not specified or is not available, the SunJavaCompiler is used.
Specified by:
createCompiler in interface JspCompilationContext

resolveRelativeUri

public java.lang.String resolveRelativeUri(java.lang.String uri)
Get the full value of a URI relative to this compilations context
Specified by:
resolveRelativeUri in interface JspCompilationContext

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String res)
Gets a resource as a stream, relative to the meanings of this context's implementation.
Specified by:
getResourceAsStream in interface JspCompilationContext

getRealPath

public java.lang.String getRealPath(java.lang.String path)
Gets the actual path of a URI relative to the context of the compilation.
Specified by:
getRealPath in interface JspCompilationContext

JSPTemplates