Deploy and start a new web application, attached to the specified Context
Path: (which must not be in use by any other web application).
This command is the logical opposite of the Undeploy command.
There are a number of different ways the deploy command can be used.
Deploy a Directory or WAR by URL
Install a web application directory or ".war" file located on the Tomcat
server. If no Context Path is specified, the directory name or the
war file name without the ".war" extension is used as the path. The
WAR or Directory URL specifies a URL (including the file:
scheme) for either a directory or a web application archive (WAR) file. The
supported syntax for a URL referring to a WAR file is described on the Javadocs
page for the java.net.JarURLConnection
class. Use only URLs that
refer to the entire WAR file.
In this example the web application located in the directory
C:\path\to\foo
on the Tomcat server (running on Windows)
is deployed as the web application context named /footoo
.
| | |
|
Context Path: /footoo
WAR or Directory URL: file:C:/path/to/foo
| |
| | |
In this example the ".war" file /path/to/bar.war
on the
Tomcat server (running on Unix) is deployed as the web application
context named /bar
. Notice that there is no path
parameter so the context path defaults to the name of the web application
archive file without the ".war" extension.
| | |
|
WAR or Directory URL: jar:file:/path/to/bar.war!/
| |
| | |
Deploy a Directory or War from the Host appBase
Install a web application directory or ".war" file located in your Host
appBase directory. If no Context Path is specified the directory name
or the war file name without the ".war" extension is used as the path.
In this example the web application located in a subdirectory named
foo
in the Host appBase directory of the Tomcat server is
deployed as the web application context named /foo
. Notice
that there is no path
parameter so the context path defaults
to the name of the web application directory.
| | |
|
WAR or Directory URL: foo
| |
| | |
In this example the ".war" file bar.war
located in your
Host appBase directory on the Tomcat server is deployed as the web
application context named /bartoo
.
| | |
|
Context Path: /bartoo
WAR or Directory URL: bar.war
| |
| | |
Deploy using a Context configuration ".xml" file
If the Host deployXML flag is set to true, you can install a web
application using a Context configuration ".xml" file and an optional
".war" file or web application directory. The Context Path
is not used when installing a web application using a context ".xml"
configuration file.
A Context configuration ".xml" file can contain valid XML for a
web application Context just as if it were configured in your
Tomcat server.xml
configuration file. Here is an
example for Tomcat running on Windows:
| | |
|
<Context path="/foobar" docBase="C:\path\to\application\foobar"
debug="0">
<!-- Link to the user database we will get roles from -->
<ResourceLink name="users" global="UserDatabase"
type="org.apache.catalina.UserDatabase"/>
</Context>
| |
| | |
Use of the WAR or Directory URL is optional. When used
to select a web application ".war" file or directory it overrides any
docBase configured in the context configuration ".xml" file.
Here is an example of installing an application using a Context
configuration ".xml" file for Tomcat running on Windows.
| | |
|
XML Configuration file URL: file:C:/path/to/context.xml
| |
| | |
Here is an example of installing an application using a Context
configuration ".xml" file and a web application ".war" file located
on the server (Tomcat running on Unix).
| | |
|
XML Configuration file URL: file:/path/to/context.xml
WAR or Directory URL: jar:file:/path/to/bar.war!/
| |
| | |