how_tomcat_workshow_tomcat_works

Page 409

setUnpackWARs(((StandardHost) host).isUnpackWARs()); The isDeployXML method of the StandardHost class indicates whether or not the host should deploy a context's descriptor file. By default the value of the deployXML property is true. The liveDeploy property indicates whether or not the host should periodically check for a new deployment, and the unpackWARs property specifies whether or not to unpack applications deployed as WAR files. Upon receiving a START event notification, the HostConfig object's lifecycleEvent method calls the start method to deploy applications. This method is given in Listing 18.2. Listing 18.2: The start method of the HostConfig class

protected void start() { if (debug >= 1) log(sm.getString("hostConfig.start")); if (host.getAutoDeploy()) { deployApps(); } if (isLiveDeploy ()) { threadStart(); } }

The start method calls the deployApps method if the autoDeploy property is true (by default, its value is true). Also, it spawns a new thread by calling the threadStart method if liveDeploy is true (which it is, by default). Live deploy is discussed further in the subsection "Live Deploy" later in this section. The deployApps method obtains the appBase property of the host. appBase by default has the value of webapps (See Tomcat's server.xml file). The deployment process regards all directories under the %CATALINE_HOME%/webapps directory as application directories to be deployed. In addition, all WAR and descriptor files found in this directory are to be deployed as well. The deployApps method is given in Listing 18.3. Listing 18.3: The deployApps method

protected void deployApps() { if (!(host instanceof Deployer))


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.