Tomcat Context
In Tomcat, a context refers to a web application and typically has a corresponding set of XML elements and attributes that define the context in server.xml file or in a seperate file. For each explicitly configured web application, there should be one context element either in server.xml or in a seperate context XML fragment file.
You can add Context element inside the Host element. A typical entry might look as below:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="false"
xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="my-webapp" path="/my-webapp"/>
</Host>
The path is what Tomcat users typically refer as context path and can be changed. For example, in the above example, the application my-webapp is available at the URL http://host:port/my-webapp.
Context entries can also appear as context XML fragment files, which are not complete server.xml configuration file, but just one context element and any sub elements that are appropriate for your web application. The limitation with context XML fragment file is that you can not specify the path attribute in them. The fragment file can either reside in the conf directory/enginename/hostname/ directory or your web app's web-inf directory.
Comments on this post:



