com.caucho.server.webapp
Class WebAppContainer

java.lang.Object
  extended by com.caucho.server.webapp.WebAppContainer
All Implemented Interfaces:
ClassLoaderListener, EnvironmentListener, DispatchBuilder, java.util.EventListener
Direct Known Subclasses:
Host

public class WebAppContainer
extends java.lang.Object
implements DispatchBuilder, ClassLoaderListener, EnvironmentListener

Resin's webApp implementation.


Constructor Summary
WebAppContainer()
          Creates the webApp with its environment loader.
WebAppContainer(EnvironmentClassLoader loader)
          Creates the webApp with its environment loader.
 
Method Summary
 void addApplication(EarConfig config)
          Adds an enterprise webApp.
 void addDeploy(DeployGenerator deploy)
          Sets the war-expansion
 void addEarDefault(EarConfig config)
          Adds an ear default
 void addEarDeploy(EarDeployGenerator earDeploy)
          Adds the ear-expansion
 void addErrorPage(ErrorPage errorPage)
          Adds an error page
 void addWarDeploy(WebAppExpandDeployGenerator webAppDeploy)
          Sets the war-expansion
 void addWebApp(WebAppConfig config)
          Adds an webApp.
 void addWebAppDefault(WebAppConfig init)
          Adds a web-app default
 void addWebAppDeploy(WebAppExpandDeployGenerator deploy)
          Sets the war-expansion
 void buildErrorInvocation(Invocation invocation)
          Creates the error invocation.
 void buildForwardInvocation(Invocation invocation)
          Creates the invocation.
 void buildIncludeInvocation(Invocation invocation)
          Creates the invocation.
 Invocation buildInvocation(Invocation invocation)
          Creates the invocation.
 void buildLoginInvocation(Invocation invocation)
          Creates the invocation.
 void classLoaderDestroy(DynamicClassLoader loader)
          Handles the case where a class loader is dropped.
 void classLoaderInit(DynamicClassLoader loader)
          Handles the case where a class loader has completed initialization
 void clearCache()
          Clears the cache
 AbstractAccessLog createAccessLog()
          Sets the access log.
 EarDeployGenerator createEarDeploy()
          Sets the ear-expansion
 RewriteDispatch createRewriteDispatch()
          Adds rewrite-dispatch.
 WebAppExpandDeployGenerator createWarDeploy()
          Sets the war-expansion
 WebAppExpandDeployGenerator createWebAppDeploy()
          Sets the war-expansion
 void destroy()
          Closes the container.
 void environmentStart(EnvironmentClassLoader loader)
          Handles the case where the environment is starting (after init).
 void environmentStop(EnvironmentClassLoader loader)
          Handles the case where the environment is stopping
 void expandEarDeploy(java.lang.String name)
          Updates an ear deploy
 WebAppController findByURI(java.lang.String uri)
          Finds the web-app matching the current entry.
 WebAppController findController(java.lang.String subURI)
          Finds the web-app for the entry, not checking for sub-apps.
 WebApp findSubWebAppByURI(java.lang.String uri)
          Creates the invocation.
 WebApp findWebAppByURI(java.lang.String uri)
          Creates the invocation.
 java.lang.ClassLoader getClassLoader()
          Gets the class loader.
 DispatchServer getDispatchServer()
          Gets the dispatch server.
 Path getDocumentDirectory()
          Gets the document directory.
 java.util.ArrayList<EarConfig> getEarDefaultList()
          Returns the list of ear defaults
 java.util.ArrayList<EarDeployController> getEntAppList()
          Returns a list of the webApps.
 ErrorPageManager getErrorPageManager()
          Returns the error page manager
 WebApp getErrorWebApp()
          Returns the error webApp during startup.
 Host getHost()
          Returns the owning host.
 java.lang.String getHostName()
          Returns the host name for the container.
 RequestDispatcher getRequestDispatcher(java.lang.String url)
          Returns a dispatcher for the named servlet.
 Path getRootDirectory()
          Gets the root directory.
 SessionManager getSessionManager()
          Returns the container's session manager.
 java.lang.String getURL()
          Returns the URL for the container.
 Path getWarDir()
          Gets the war-dir.
 Path getWarExpandDir()
          Gets the war-expand-dir.
 java.util.ArrayList<WebAppConfig> getWebAppDefaultList()
          Returns the list of web-app defaults
 DeployContainer<WebAppController> getWebAppGenerator()
          Returns the webApp generator
 java.util.ArrayList<WebAppController> getWebAppList()
          Returns a list of the webApps.
 void init()
          Init the container.
 boolean isActive()
          Returns true if the webApp container is active
 boolean isDestroyed()
          Returns true if the webApp container has been closed.
 boolean isModified()
          Returns true if modified.
 void removeWebAppDeploy(DeployGenerator deploy)
          Removes a web-app-generator.
 void setAccessLog(AbstractAccessLog log)
          Sets the access log.
 void setConfigException(java.lang.Throwable e)
          Sets a configuration exception.
 void setDispatchServer(DispatchServer server)
          Sets the dispatch server.
 void setDocDir(Path path)
          Sets the document directory.
 void setDocumentDirectory(Path path)
          Sets the document directory.
 void setEnvironmentClassLoader(EnvironmentClassLoader loader)
          sets the class loader.
 void setRootDirectory(Path path)
          Sets the root directory.
 void setWarDir(Path warDir)
          Sets the war-dir for backwards compatibility.
 void setWarExpandDir(Path warDir)
          Sets the war-expand-dir.
protected  void start()
          Starts the container.
 void startEarDeploy(java.lang.String name)
          Start an ear
 boolean stop()
          Closes the container.
 void updateEarDeploy(java.lang.String name)
          Updates an ear deploy
 void updateWebAppDeploy(java.lang.String name)
          Updates a WebApp deploy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebAppContainer

public WebAppContainer()
Creates the webApp with its environment loader.


WebAppContainer

public WebAppContainer(EnvironmentClassLoader loader)
Creates the webApp with its environment loader.

Method Detail

setDispatchServer

public void setDispatchServer(DispatchServer server)
Sets the dispatch server.


getDispatchServer

public DispatchServer getDispatchServer()
Gets the dispatch server.


getClassLoader

public java.lang.ClassLoader getClassLoader()
Gets the class loader.


setEnvironmentClassLoader

public void setEnvironmentClassLoader(EnvironmentClassLoader loader)
sets the class loader.


getHost

public Host getHost()
Returns the owning host.


getRootDirectory

public Path getRootDirectory()
Gets the root directory.


setRootDirectory

public void setRootDirectory(Path path)
Sets the root directory.


getDocumentDirectory

public Path getDocumentDirectory()
Gets the document directory.


setDocumentDirectory

public void setDocumentDirectory(Path path)
Sets the document directory.


setDocDir

public void setDocDir(Path path)
Sets the document directory.


createAccessLog

public AbstractAccessLog createAccessLog()
Sets the access log.


setAccessLog

public void setAccessLog(AbstractAccessLog log)
Sets the access log.


addErrorPage

public void addErrorPage(ErrorPage errorPage)
Adds an error page


getErrorPageManager

public ErrorPageManager getErrorPageManager()
Returns the error page manager


setConfigException

public void setConfigException(java.lang.Throwable e)
Sets a configuration exception.


getWebAppGenerator

public DeployContainer<WebAppController> getWebAppGenerator()
Returns the webApp generator


getSessionManager

public SessionManager getSessionManager()
Returns the container's session manager.


createRewriteDispatch

public RewriteDispatch createRewriteDispatch()
Adds rewrite-dispatch.


isModified

public boolean isModified()
Returns true if modified.


addWebApp

public void addWebApp(WebAppConfig config)
               throws java.lang.Exception
Adds an webApp.

Throws:
java.lang.Exception

addWebAppDefault

public void addWebAppDefault(WebAppConfig init)
Adds a web-app default


getWebAppDefaultList

public java.util.ArrayList<WebAppConfig> getWebAppDefaultList()
Returns the list of web-app defaults


createWarDeploy

public WebAppExpandDeployGenerator createWarDeploy()
Sets the war-expansion


createWebAppDeploy

public WebAppExpandDeployGenerator createWebAppDeploy()
Sets the war-expansion


addWebAppDeploy

public void addWebAppDeploy(WebAppExpandDeployGenerator deploy)
                     throws ConfigException
Sets the war-expansion

Throws:
ConfigException

addWarDeploy

public void addWarDeploy(WebAppExpandDeployGenerator webAppDeploy)
                  throws ConfigException
Sets the war-expansion

Throws:
ConfigException

addDeploy

public void addDeploy(DeployGenerator deploy)
               throws ConfigException
Sets the war-expansion

Throws:
ConfigException

removeWebAppDeploy

public void removeWebAppDeploy(DeployGenerator deploy)
Removes a web-app-generator.


updateWebAppDeploy

public void updateWebAppDeploy(java.lang.String name)
                        throws java.lang.Throwable
Updates a WebApp deploy

Throws:
java.lang.Throwable

addApplication

public void addApplication(EarConfig config)
Adds an enterprise webApp.


updateEarDeploy

public void updateEarDeploy(java.lang.String name)
                     throws java.lang.Throwable
Updates an ear deploy

Throws:
java.lang.Throwable

expandEarDeploy

public void expandEarDeploy(java.lang.String name)
Updates an ear deploy


startEarDeploy

public void startEarDeploy(java.lang.String name)
Start an ear


addEarDefault

public void addEarDefault(EarConfig config)
Adds an ear default


getEarDefaultList

public java.util.ArrayList<EarConfig> getEarDefaultList()
Returns the list of ear defaults


createEarDeploy

public EarDeployGenerator createEarDeploy()
                                   throws java.lang.Exception
Sets the ear-expansion

Throws:
java.lang.Exception

addEarDeploy

public void addEarDeploy(EarDeployGenerator earDeploy)
                  throws java.lang.Exception
Adds the ear-expansion

Throws:
java.lang.Exception

getURL

public java.lang.String getURL()
Returns the URL for the container.


getHostName

public java.lang.String getHostName()
Returns the host name for the container.


setWarDir

public void setWarDir(Path warDir)
               throws ConfigException
Sets the war-dir for backwards compatibility.

Throws:
ConfigException

getWarDir

public Path getWarDir()
Gets the war-dir.


setWarExpandDir

public void setWarExpandDir(Path warDir)
Sets the war-expand-dir.


getWarExpandDir

public Path getWarExpandDir()
Gets the war-expand-dir.


init

public void init()
          throws java.lang.Exception
Init the container.

Throws:
java.lang.Exception

start

protected void start()
Starts the container.


clearCache

public void clearCache()
Clears the cache


buildInvocation

public Invocation buildInvocation(Invocation invocation)
                           throws java.lang.Exception
Creates the invocation.

Specified by:
buildInvocation in interface DispatchBuilder
Throws:
java.lang.Exception

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(java.lang.String url)
Returns a dispatcher for the named servlet.


buildIncludeInvocation

public void buildIncludeInvocation(Invocation invocation)
                            throws ServletException
Creates the invocation.

Throws:
ServletException

buildForwardInvocation

public void buildForwardInvocation(Invocation invocation)
                            throws ServletException
Creates the invocation.

Throws:
ServletException

buildErrorInvocation

public void buildErrorInvocation(Invocation invocation)
                          throws ServletException
Creates the error invocation.

Throws:
ServletException

buildLoginInvocation

public void buildLoginInvocation(Invocation invocation)
                          throws ServletException
Creates the invocation.

Throws:
ServletException

findWebAppByURI

public WebApp findWebAppByURI(java.lang.String uri)
                       throws java.lang.Exception
Creates the invocation.

Throws:
java.lang.Exception

findSubWebAppByURI

public WebApp findSubWebAppByURI(java.lang.String uri)
                          throws java.lang.Exception
Creates the invocation.

Throws:
java.lang.Exception

findByURI

public WebAppController findByURI(java.lang.String uri)
Finds the web-app matching the current entry.


findController

public WebAppController findController(java.lang.String subURI)
Finds the web-app for the entry, not checking for sub-apps. (used by LocalDeployServlet)


getWebAppList

public java.util.ArrayList<WebAppController> getWebAppList()
Returns a list of the webApps.


getEntAppList

public java.util.ArrayList<EarDeployController> getEntAppList()
Returns a list of the webApps.


isDestroyed

public final boolean isDestroyed()
Returns true if the webApp container has been closed.


isActive

public final boolean isActive()
Returns true if the webApp container is active


stop

public boolean stop()
Closes the container.


destroy

public void destroy()
Closes the container.


getErrorWebApp

public WebApp getErrorWebApp()
Returns the error webApp during startup.


classLoaderInit

public void classLoaderInit(DynamicClassLoader loader)
Handles the case where a class loader has completed initialization

Specified by:
classLoaderInit in interface ClassLoaderListener

classLoaderDestroy

public void classLoaderDestroy(DynamicClassLoader loader)
Handles the case where a class loader is dropped.

Specified by:
classLoaderDestroy in interface ClassLoaderListener

environmentStart

public void environmentStart(EnvironmentClassLoader loader)
Handles the case where the environment is starting (after init).

Specified by:
environmentStart in interface EnvironmentListener

environmentStop

public void environmentStop(EnvironmentClassLoader loader)
Handles the case where the environment is stopping

Specified by:
environmentStop in interface EnvironmentListener