org.apache.jasper
Class CommandLineContext

java.lang.Object
  |
  +--org.apache.jasper.CommandLineContext
All Implemented Interfaces:
JspCompilationContext

public class CommandLineContext
extends java.lang.Object
implements JspCompilationContext

Holds data used on a per-page compilation context that would otherwise spill over to other pages being compiled. Things like the taglib classloaders and directives.

Author:
Danno Ferrin, Pierre Delisle

Nested Class Summary
 
Nested classes inherited from class org.apache.jasper.JspCompilationContext
JspCompilationContext.Interface1
 
Constructor Summary
CommandLineContext(java.lang.String newClassPath, java.lang.String newJspFile, java.lang.String newUriBase, java.lang.String newUriRoot, boolean newErrPage, Options newOptions)
           
 
Method Summary
 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?
 java.lang.String getClassPath()
          The classpath that is passed off to the Java compiler.
 java.lang.String getContentType()
          The content type of this JSP.
 java.lang.String getJavacOutputDir()
          The scratch directory to generate code into for javac.
 java.lang.String getJspFile()
          Path of the JSP URI.
 Options getOptions()
          Get hold of the Options object for this context.
 java.lang.String getOutputDir()
          The scratch directory to generate code into.
 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.
 java.net.URL getResource(java.lang.String res)
           
 java.io.InputStream getResourceAsStream(java.lang.String res)
          Gets a resource as a stream, relative to the meanings of this context's implementation.
 java.lang.String getServletClassName()
          Just the class name (does not include package name) of the generated class.
 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 for the generated class.
 java.lang.String[] getTldLocation(java.lang.String uri)
          Get the 'location' of the TLD associated with a given taglib 'uri'.
 ServletWriter getWriter()
          Where is the servlet being generated?
 boolean isErrorPage()
          Are we processing something that has been declared as an errorpage?
 boolean isOutputInDirs()
           
 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 uses current file as the base.
 void setClassLoader(java.net.URLClassLoader loader)
           
 void setContentType(java.lang.String contentType)
           
 void setErrorPage(boolean isErrPage)
           
 void setOutputInDirs(boolean newValue)
           
 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

CommandLineContext

public CommandLineContext(java.lang.String newClassPath,
                          java.lang.String newJspFile,
                          java.lang.String newUriBase,
                          java.lang.String newUriRoot,
                          boolean newErrPage,
                          Options newOptions)
                   throws JasperException
Method Detail

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

getClassLoader

public java.lang.ClassLoader getClassLoader()
What class loader to use for loading classes while compiling this JSP?

Specified by:
getClassLoader 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()
The scratch directory to generate 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

getJavacOutputDir

public java.lang.String getJavacOutputDir()
The scratch directory to generate code into for javac. FIXME: In some places this is called scratchDir and in some other places it is called outputDir.

Specified by:
getJavacOutputDir 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 for the generated class. The final package is assembled from the one specified in -p, and the one derived from the path to jsp file.

Specified by:
getServletPackageName 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()
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

setClassLoader

public void setClassLoader(java.net.URLClassLoader loader)

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

setOutputInDirs

public void setOutputInDirs(boolean newValue)

isOutputInDirs

public boolean isOutputInDirs()

createCompiler

public Compiler createCompiler()
                        throws JasperException
Create a "Compiler" object based on some init param data. This is not done yet. Right now we're just hardcoding the actual compilers that are created.

Specified by:
createCompiler in interface JspCompilationContext
JasperException

resolveRelativeUri

public java.lang.String resolveRelativeUri(java.lang.String uri)
Get the full value of a URI relative to this compilations context uses current file as the base.

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
Returns:
a null if the resource cannot be found or represented as an InputStream.

getResource

public java.net.URL getResource(java.lang.String res)
                         throws java.net.MalformedURLException
Specified by:
getResource in interface JspCompilationContext
java.net.MalformedURLException

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

getTldLocation

public java.lang.String[] getTldLocation(java.lang.String uri)
                                  throws JasperException
Description copied from interface: JspCompilationContext
Get the 'location' of the TLD associated with a given taglib 'uri'.

Specified by:
getTldLocation in interface JspCompilationContext
Returns:
An array of two Strings. The first one is real path to the TLD. If the path to the TLD points to a jar file, then the second string is the name of the entry for the TLD in the jar file. Returns null if the uri is not associated to a tag library 'exposed' in the web application. A tag library is 'exposed' either explicitely in web.xml or implicitely via the uri tag in the TLD of a taglib deployed in a jar file (WEB-INF/lib).
JasperException


Copyright © 2000 Apache Software Foundation. All Rights Reserved.