⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 manual.html

📁 软件工程方面的好书
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>The Apache Tomcat 5.5 Servlet/JSP Container - Tomcat Web Application Deployment</title><meta value="Allistair Crossley" name="author"><meta value="" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="0" width="100%" border="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img border="0" alt="
      The Apache Tomcat Servlet/JSP Container
    " align="right" src="./../images/tomcat.gif"></a></td><td><font face="arial,helvetica,sanserif"><h1>The Apache Tomcat 5.5 Servlet/JSP Container</h1></font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img border="0" alt="Apache Logo" align="right" src="./../images/asf-logo.gif"></a></td></tr></table><table cellspacing="4" width="100%" border="0"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade="noshade"></td></tr><tr><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td valign="top" align="left"><h1>The Apache Tomcat 5.5 Servlet/JSP Container</h1><h2>Tomcat Web Application Deployment</h2></td><td nowrap="true" valign="top" align="right"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Table of Contents"><strong>Table of Contents</strong></a></font></td></tr><tr><td><blockquote>
    <ul>
        <li><a href="#Introduction">Introduction</a></li>
        <li><a href="#Installation">Installation</a></li>
        <li><a href="#A word on Contexts">A word on Contexts</a></li>
        <li><a href="#Deployment on Tomcat startup">Deployment on Tomcat startup</a></li>
        <li><a href="#Deploying on a running Tomcat server">Deploying on a running Tomcat server</a></li>
        <li><a href="#Deploying using the Tomcat Manager">Deploying using the Tomcat Manager</a></li>
        <li><a href="#Deploying using the Client Deployer Package">Deploying using
            the Tomcat Client Deployer</a></li>
    </ul>
    
    </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
        <p>
            Deployment is the term used for the process of installing a web
            application (either a 3rd party WAR or your own custom web application) 
            into the Tomcat server. 
        </p>
        <p>
            Web application deployment may be accomplished in a number of ways
            within the Tomcat server.
            <ul>
                <li>Statically; the web application is setup before Tomcat is started</li>
                <li>
                    Dynamically; in conjunction with the Tomcat Manager web application or 
                    manipulating already deployed web applications
                </li>
            </ul>
        </p>
        <p>
            The Tomcat Manager is a tool that allows URL-based web application
            deployment features. There is also a tool called the Client Deployer,
            which is a command shell based script that interacts with the Tomcat
            Manager but provides additional functionality such as compiling and
            validating web applications as well as packaging web application into
            web application resource (WAR) files.
        </p>
    </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Installation"><strong>Installation</strong></a></font></td></tr><tr><td><blockquote>
        <p>
            There is no installation required for static deployment of web
            applications as this is provided out of the box by Tomcat. Nor is any
            installation required for deployment functions with the Tomcat Manager, 
            although some configuration is required as detailed in the 
            Tomcat Manager manual. An installation is however required if you wish
            to use the Tomcat Client Deployer (TCD). 
        </p>   
        <p>
            The TCD is not packaged with the Tomcat core 
            distribution, and must therefore be downloaded separately from 
            the Downloads area. The download is usually labelled 
            <i>jakarta-tomcat-5.5.x-deployer</i>.
        </p>
        <p>
            TCD has prerequisites of Apache Ant 1.6.2+ and a Java installation.
            Your environment should define an ANT_HOME environment value pointing to
            the root of your Ant installation, and a JAVA_HOME value pointing to
            your Java installation. Additionally, you should ensure Ant's ant
            command, and the Java javac compiler command run from the command shell
            that your operating system provides.
        </p>
        <ol>
            <li>Download the TCD distribution</li>
            <li>
                The TCD package need not be extracted into any existing Tomcat
                installation, it can be extracted to any location.
            </li>
            <li>Read Using the <a href="#Deploying using the Client Deployer Package">
            Tomcat Client Deployer</a></li>
        </ol>
    </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="A word on Contexts"><strong>A word on Contexts</strong></a></font></td></tr><tr><td><blockquote>
        <p>
            In talking about deployment of web applications, the concept of a
            <i>Context</i> is required to be understood. A Context is what Tomcat 
            calls a web application.
        </p>
        <p>
            In order to configure a Context within Tomcat a <i>Context Descriptor</i>
            is required. A Context Descriptor is simply an XML file that contains
            Tomcat related configuration for a Context, e.g naming resources or 
            session manager configuration. In earlier versions of
            Tomcat the content of a Context Descriptor configuration was often stored within
            Tomcat's primary configuration file <i>server.xml</i> but this is now
            discouraged (although it currently still works).
        </p>
        <p>        
            Context Descriptors not only help Tomcat to know how to configure 
            Contexts but other tools such as the Tomcat Manager and TDC often use 
            these Context Descriptors to perform their roles properly.
        </p>
        <p>
            The locations for Context Descriptors are;
            <ol>
                <li>$CATALINA_HOME/conf/[enginename]/[hostname]/context.xml</li>
                <li>$CATALINA_HOME/webapps/[webappname]/META-INF/context.xml</li>
            </ol>
            Files in (1) are named [webappname].xml but files in (2) are named
            context.xml. If a Context Descriptor is not provided for a Context,
            Tomcat configures the Context using default values.
        </p>
    </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Deployment on Tomcat startup"><strong>Deployment on Tomcat startup</strong></a></font></td></tr><tr><td><blockquote>
        <p>
            If you are not interested in using the Tomcat Manager, or TCD, 
            then you'll need to deploy your web applications 
            statically to Tomcat, followed by a Tomcat startup. The location you
            deploy web applications to for this type of deployment is called the 
            <code>appBase</code> which is specified per Host. You either copy a
            so-called <i>exploded web application</i>, i.e non-compressed, to this
            location, or a compressed web application resource .WAR file.
        </p>
        <p>
            The web applications present in the location specified by the Host's
            (default Host is "localhost") <code>appBase</code> attribute (default
            appBase is "$CATALINA_HOME/webapps") will be deployed on Tomcat startup 
            only if the Host's <code>deployOnStartup</code> attribute is "true".
        </p>
        <p>
            The following deployment sequence will occur on Tomcat startup in that
            case:
        </p>
        <ol>
            <li>Any Context Descriptors will be deployed first.</li>
            <li>
                Exploded web applications not referenced by any Context
                Descriptor will then be deployed. If they have an associated 
                .WAR file in the appBase and it is newer than the exploded web application, 
                the exploded directory will be removed and the webapp will be 
                redeployed from the .WAR
            </li>
            <li>.WAR files will be deployed</li>
        </ol>
        <p>
            Note again that for each deployed web application, a 
            Context Descriptor will be created <i>unless one exists already</i>.
        </p>
    </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Deploying on a running Tomcat server"><strong>Deploying on a running Tomcat server</strong></a></font></td></tr><tr><td><blockquote>
        <p>
            It is possible to deploy web applications to a running Tomcat server.
        </p>
        <p>
            If the Host <code>autoDeploy</code> attribute is "true", the Host will 
            attempt to deploy and update web applications dynamically, as needed,
            for example if a new .WAR is dropped into the <code>appBase</code>. 
            For this to work, the Host needs to have background processing 
            enabled which is the default configuration.
        </p>
        
        <p>
            <code>autoDeploy</code> set to "true" and a running Tomcat allows for:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -