com.caucho.jsp
Class JspCompiler

java.lang.Object
  extended by com.caucho.jsp.JspCompiler
All Implemented Interfaces:
EnvironmentBean

public class JspCompiler
extends java.lang.Object
implements EnvironmentBean

Compilation interface for JSP pages.

 com.caucho.jsp.JspCompiler [flags] jsp1 jsp2 ...");
     -app-dir  : The directory root of the web-app.");
     -class-dir: The working directory to use as output.");
     -conf: A configuration file for the compiler.");
 


Nested Class Summary
 class JspCompiler.ApplicationConfig
           
 
Constructor Summary
JspCompiler()
           
 
Method Summary
 void addCoda(java.lang.String coda)
          Adds a coda include.
 void addPrelude(java.lang.String prelude)
          Adds a prelude include.
 boolean addTag(java.lang.String className)
          Adds a new tag being compiled.
 void close()
           
 Page compile(Path jspPath, java.lang.String uri)
          Compiles the JSP file specified with jspFile.
 void compileBatch(java.lang.String[] pendingClasses)
           
 void compilePath(java.util.ArrayList<java.lang.String> pendingClasses, java.lang.String uri)
           
 int configureFromArgs(java.lang.String[] args)
          Callable by applications to initialize the compiler.
 JspCompiler.ApplicationConfig createApplication()
          Initialize values based on the ServletContext.
 JsfPropertyGroup createJsf()
          Sets JsfPropertyGropu
 JspPropertyGroup createJsp()
          Sets the JspPropertyGroup
 WebApp createWebApp(Path rootDirectory)
          Initialize values based on the ServletContext.
 Path getAppDir()
          Gets the source webApp directory.
 Path getClassDir()
          Gets the destination class directory.
 java.lang.ClassLoader getClassLoader()
          Returns the classloader for configuration.
 JspCompilerInstance getCompilerInstance(Path jspPath, java.lang.String uri)
          Returns the compilation instance.
 JspCompilerInstance getCompilerInstance(Path jspPath, java.lang.String uri, java.lang.String className)
          Returns the compilation instance.
 JsfPropertyGroup getJsfPropertyGroup()
          Gets JsfPropertyGroup
 JspPropertyGroup getJspPropertyGroup()
          Sets the JspPropertyGroup
 JspResourceManager getResourceManager()
          Gets the resource manager.
 TagFileManager getTagFileManager()
          Gets the tag file manager.
 TaglibManager getTaglibManager()
           
 WebApp getWebApp()
          Returns the app.
 boolean hasRecursiveCompile()
          Has recursive compile.
 void init()
           
 boolean isXml()
          True when XML is the default parser.
 java.lang.Object loadClass(java.lang.String className, boolean autoCompile)
          Loads an already-compiled JSP class.
 Page loadPage(java.lang.String className, boolean isAutoCompile)
          Loads an already-compiled JSP class.
 Page loadStatic(java.lang.String className, boolean isSession)
          Loads an already-compiled JSP class.
static void main(java.lang.String[] args)
           
 void setAppDir(Path path)
          Sets the source webApp directory.
 void setClassDir(Path path)
          Sets the destination class directory.
 void setClassDirectory(Path path)
          Sets the destination class directory.
 void setClassLoader(java.lang.ClassLoader loader)
           
 void setResourceManager(JspResourceManager manager)
          Sets the resource manager.
 void setWebApp(WebApp app)
          Initialize values based on the ServletContext.
 void setXml(boolean isXml)
          Set true when XML is the default parser.
static java.lang.String urlToClassName(java.lang.String name)
          Mangles the name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JspCompiler

public JspCompiler()
Method Detail

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns the classloader for configuration.

Specified by:
getClassLoader in interface EnvironmentBean

setClassLoader

public void setClassLoader(java.lang.ClassLoader loader)

setClassDir

public void setClassDir(Path path)
Sets the destination class directory.


setClassDirectory

public void setClassDirectory(Path path)
Sets the destination class directory.


getClassDir

public Path getClassDir()
Gets the destination class directory.


setAppDir

public void setAppDir(Path path)
Sets the source webApp directory.


getAppDir

public Path getAppDir()
Gets the source webApp directory.


addPrelude

public void addPrelude(java.lang.String prelude)
Adds a prelude include.


addCoda

public void addCoda(java.lang.String coda)
Adds a coda include.


setXml

public void setXml(boolean isXml)
Set true when XML is the default parser.


isXml

public boolean isXml()
True when XML is the default parser.


setResourceManager

public void setResourceManager(JspResourceManager manager)
Sets the resource manager.


getResourceManager

public JspResourceManager getResourceManager()
Gets the resource manager.


getTagFileManager

public TagFileManager getTagFileManager()
Gets the tag file manager.


getTaglibManager

public TaglibManager getTaglibManager()
                               throws JspParseException,
                                      java.io.IOException
Throws:
JspParseException
java.io.IOException

createJsp

public JspPropertyGroup createJsp()
Sets the JspPropertyGroup


getJspPropertyGroup

public JspPropertyGroup getJspPropertyGroup()
Sets the JspPropertyGroup


createJsf

public JsfPropertyGroup createJsf()
Sets JsfPropertyGropu


getJsfPropertyGroup

public JsfPropertyGroup getJsfPropertyGroup()
Gets JsfPropertyGroup


createWebApp

public WebApp createWebApp(Path rootDirectory)
Initialize values based on the ServletContext. When the calling code has the ServletContext available, it can take advantage of it.


setWebApp

public void setWebApp(WebApp app)
Initialize values based on the ServletContext. When the calling code has the ServletContext available, it can take advantage of it.


createApplication

public JspCompiler.ApplicationConfig createApplication()
Initialize values based on the ServletContext. When the calling code has the ServletContext available, it can take advantage of it.


getWebApp

public WebApp getWebApp()
Returns the app.


addTag

public boolean addTag(java.lang.String className)
Adds a new tag being compiled.


hasRecursiveCompile

public boolean hasRecursiveCompile()
Has recursive compile.


urlToClassName

public static java.lang.String urlToClassName(java.lang.String name)
Mangles the name.


compile

public Page compile(Path jspPath,
                    java.lang.String uri)
             throws java.lang.Exception
Compiles the JSP file specified with jspFile.

Parameters:
jspPath - the path to the JSP source
uri - the uri for the JSP file
Returns:
a JspPage instance
Throws:
java.lang.Exception

getCompilerInstance

public JspCompilerInstance getCompilerInstance(Path jspPath,
                                               java.lang.String uri)
                                        throws java.lang.Exception
Returns the compilation instance.

Throws:
java.lang.Exception

init

public void init()
          throws JspParseException,
                 java.io.IOException
Throws:
JspParseException
java.io.IOException

getCompilerInstance

public JspCompilerInstance getCompilerInstance(Path jspPath,
                                               java.lang.String uri,
                                               java.lang.String className)
                                        throws java.lang.Exception
Returns the compilation instance.

Throws:
java.lang.Exception

loadPage

public Page loadPage(java.lang.String className,
                     boolean isAutoCompile)
              throws java.lang.Throwable
Loads an already-compiled JSP class.

Parameters:
className - the mangled classname for the JSP file.
Throws:
java.lang.Throwable

loadClass

public java.lang.Object loadClass(java.lang.String className,
                                  boolean autoCompile)
                           throws java.lang.Throwable
Loads an already-compiled JSP class.

Parameters:
className - the mangled classname for the JSP file.
Throws:
java.lang.Throwable

loadStatic

public Page loadStatic(java.lang.String className,
                       boolean isSession)
                throws java.lang.Exception
Loads an already-compiled JSP class.

Parameters:
className - the mangled classname for the JSP file.
Throws:
java.lang.Exception

close

public void close()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

configureFromArgs

public int configureFromArgs(java.lang.String[] args)
                      throws java.lang.Exception
Callable by applications to initialize the compiler. This call will configure the JspCompiler, but not start any compilations.
 com.caucho.jsp.JspCompiler [flags] jsp1 jsp2 ...");
     -app-dir  : The directory root of the web-app.");
     -class-dir: The working directory to use as output.");
     -conf: A configuration file for the compiler.");
 

Throws:
java.lang.Exception

compilePath

public void compilePath(java.util.ArrayList<java.lang.String> pendingClasses,
                        java.lang.String uri)
                 throws java.lang.Exception
Throws:
java.lang.Exception

compileBatch

public void compileBatch(java.lang.String[] pendingClasses)
                  throws java.lang.Exception
Throws:
java.lang.Exception