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:
 #

i am having trouble with the context listener, context root, and context descriptor when i debug

 

Post new comment

The content of this field is kept private and will not be shown publicly.

Download Tcat Server - Tomcat Simplified

Develop, diagnose, manage, configure, and deploy your Apache Tomcat applications with ease, and break free from bloated legacy JEE app servers. Built on 100% Tomcat, with no changes to the core code, Tcat Server is free for developers, and there is no commitment required. Try it now, risk-free! 
 

click thumbnail to enlarge

Link to this page