Class StandardHostDeployer
- java.lang.Object
-
- org.apache.catalina.core.StandardHostDeployer
-
-
Field Summary
Fields Modifier and Type Field Description protected StandardHosthostTheStandardHostinstance we are associated with.-
Fields inherited from interface org.apache.catalina.Deployer
INSTALL_EVENT, PRE_INSTALL_EVENT, REMOVE_EVENT
-
-
Constructor Summary
Constructors Constructor Description StandardHostDeployer()StandardHostDeployer(StandardHost host)Create a new StandardHostDeployer associated with the specified StandardHost.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(Container child)Delegate a request to add a child Context to our associated Host.protected DigestercreateDigester()Create (if necessary) and return a Digester configured to process the context configuration descriptor for an application.protected voiddeleteDir(File dir)Delete the specified directory, including all of its contents and subdirectories recursively.protected voiddeleteFile(File dir)ContextfindDeployedApp(String contextPath)Return the Context for the deployed application that is associated with the specified context path (if any); otherwise returnnull.String[]findDeployedApps()Return the context paths of all deployed web applications in this Container.HostgetHost()StringgetName()Return the name of the Container with which this Deployer is associated.ClassLoadergetParentClassLoader()Delegate a request for the parent class loader to our associated Host.voidinstall(String contextPath, URL war)Install a new web application, whose web application archive is at the specified URL, into this container with the specified context path.voidinstall(String contextPath, URL war, String configFile)Install a new web application, whose web application archive is at the specified URL, into this container with the specified context path.voidinstall(URL config, URL war)Install a new web application, whose context configuration file (consisting of a<Context>element) and (optional) web application archive are at the specified URLs.voidremove(String contextPath)Remove an existing web application, attached to the specified context path.voidremove(String contextPath, boolean undeploy)Remove an existing web application, attached to the specified context path.voidsetHost(Host host)voidstart(String contextPath)Start an existing web application, attached to the specified context path.voidstop(String contextPath)Stop an existing web application, attached to the specified context path.
-
-
-
Field Detail
-
host
protected StandardHost host
TheStandardHostinstance we are associated with.
-
-
Constructor Detail
-
StandardHostDeployer
public StandardHostDeployer()
-
StandardHostDeployer
public StandardHostDeployer(StandardHost host)
Create a new StandardHostDeployer associated with the specified StandardHost.- Parameters:
host- The StandardHost we are associated with
-
-
Method Detail
-
getHost
public Host getHost()
-
setHost
public void setHost(Host host)
-
getName
public String getName()
Return the name of the Container with which this Deployer is associated.
-
install
public void install(String contextPath, URL war) throws IOException
Install a new web application, whose web application archive is at the specified URL, into this container with the specified context path. A context path of "" (the empty string) should be used for the root application for this container. Otherwise, the context path must start with a slash.If this application is successfully installed, a ContainerEvent of type
PRE_INSTALL_EVENTwill be sent to registered listeners before the associated Context is started, and a ContainerEvent of typeINSTALL_EVENTwill be sent to all registered listeners after the associated Context is started, with the newly createdContextas an argument.- Specified by:
installin interfaceDeployer- Parameters:
contextPath- The context path to which this application should be installed (must be unique)war- A URL of type "jar:" that points to a WAR file, or type "file:" that points to an unpacked directory structure containing the web application to be installed- Throws:
IllegalArgumentException- if the specified context path is malformed (it must be "" or start with a slash)IllegalStateException- if the specified context path is already attached to an existing web applicationIOException- if an input/output error was encountered during installation
-
install
public void install(String contextPath, URL war, String configFile) throws IOException
Install a new web application, whose web application archive is at the specified URL, into this container with the specified context path. A context path of "" (the empty string) should be used for the root application for this container. Otherwise, the context path must start with a slash.If this application is successfully installed, a ContainerEvent of type
PRE_INSTALL_EVENTwill be sent to registered listeners before the associated Context is started, and a ContainerEvent of typeINSTALL_EVENTwill be sent to all registered listeners after the associated Context is started, with the newly createdContextas an argument.- Parameters:
contextPath- The context path to which this application should be installed (must be unique)war- A URL of type "jar:" that points to a WAR file, or type "file:" that points to an unpacked directory structure containing the web application to be installedconfigFile- The path to a file to save the Context information. If configFile is null, the Context information is saved in server.xml; if it is NOT null, the Context information is saved in configFile.- Throws:
IllegalArgumentException- if the specified context path is malformed (it must be "" or start with a slash)IllegalStateException- if the specified context path is already attached to an existing web applicationIOException- if an input/output error was encountered during installation
-
install
public void install(URL config, URL war) throws IOException
Install a new web application, whose context configuration file (consisting of a
If this application is successfully installed, a ContainerEvent of type<Context>element) and (optional) web application archive are at the specified URLs.PRE_INSTALL_EVENTwill be sent to registered listeners before the associated Context is started, and a ContainerEvent of typeINSTALL_EVENTwill be sent to all registered listeners after the associated Context is started, with the newly createdContextas an argument.- Specified by:
installin interfaceDeployer- Parameters:
config- A URL that points to the context configuration descriptor to be used for configuring the new Contextwar- A URL of type "jar:" that points to a WAR file, or type "file:" that points to an unpacked directory structure containing the web application to be installed, ornullto use thedocBaseattribute from the configuration descriptor- Throws:
IllegalArgumentException- if one of the specified URLs is nullIllegalStateException- if the context path specified in the context configuration file is already attached to an existing web applicationIOException- if an input/output error was encountered during installation
-
findDeployedApp
public Context findDeployedApp(String contextPath)
Return the Context for the deployed application that is associated with the specified context path (if any); otherwise returnnull.- Specified by:
findDeployedAppin interfaceDeployer- Parameters:
contextPath- The context path of the requested web application
-
findDeployedApps
public String[] findDeployedApps()
Return the context paths of all deployed web applications in this Container. If there are no deployed applications, a zero-length array is returned.- Specified by:
findDeployedAppsin interfaceDeployer
-
remove
public void remove(String contextPath) throws IOException
Remove an existing web application, attached to the specified context path. If this application is successfully removed, a ContainerEvent of typeREMOVE_EVENTwill be sent to all registered listeners, with the removedContextas an argument.- Specified by:
removein interfaceDeployer- Parameters:
contextPath- The context path of the application to be removed- Throws:
IllegalArgumentException- if the specified context path is malformed (it must be "" or start with a slash)IllegalArgumentException- if the specified context path does not identify a currently installed web applicationIOException- if an input/output error occurs during removal
-
remove
public void remove(String contextPath, boolean undeploy) throws IOException
Remove an existing web application, attached to the specified context path. If this application is successfully removed, a ContainerEvent of typeREMOVE_EVENTwill be sent to all registered listeners, with the removedContextas an argument. Deletes the web application war file and/or directory if they exist in the Host's appBase.- Specified by:
removein interfaceDeployer- Parameters:
contextPath- The context path of the application to be removedundeploy- boolean flag to remove web application from server- Throws:
IllegalArgumentException- if the specified context path is malformed (it must be "" or start with a slash)IllegalArgumentException- if the specified context path does not identify a currently installed web applicationIOException- if an input/output error occurs during removal
-
start
public void start(String contextPath) throws IOException
Start an existing web application, attached to the specified context path. Only starts a web application if it is not running.- Specified by:
startin interfaceDeployer- Parameters:
contextPath- The context path of the application to be started- Throws:
IllegalArgumentException- if the specified context path is malformed (it must be "" or start with a slash)IllegalArgumentException- if the specified context path does not identify a currently installed web applicationIOException- if an input/output error occurs during startup
-
stop
public void stop(String contextPath) throws IOException
Stop an existing web application, attached to the specified context path. Only stops a web application if it is running.- Specified by:
stopin interfaceDeployer- Parameters:
contextPath- The context path of the application to be stopped- Throws:
IllegalArgumentException- if the specified context path is malformed (it must be "" or start with a slash)IllegalArgumentException- if the specified context path does not identify a currently installed web applicationIOException- if an input/output error occurs while stopping the web application
-
addChild
public void addChild(Container child)
Delegate a request to add a child Context to our associated Host.- Parameters:
child- The child Context to be added
-
getParentClassLoader
public ClassLoader getParentClassLoader()
Delegate a request for the parent class loader to our associated Host.
-
createDigester
protected Digester createDigester()
Create (if necessary) and return a Digester configured to process the context configuration descriptor for an application.
-
deleteDir
protected void deleteDir(File dir)
Delete the specified directory, including all of its contents and subdirectories recursively.- Parameters:
dir- File object representing the directory to be deleted
-
deleteFile
protected void deleteFile(File dir)
-
-