Servlet Development Guide : PART II Administration : Chapter 4 Configuring Objects in the Servlet Container : Create a Context Directory
Create a Context Directory
Servlet contexts must be placed in the Agent directory <installdir>\apps\servlets. Each directory beneath <installdir>\apps\servlets defines a context. To create a new servlet context, simply create a new subdirectory under <installdir>\apps\servlets.
For example, to create a context named myapp, create a directory with that name under <installdir>\apps\servlets. Create a WEB-INF directory under myapp, and the context directory structure is complete. Before starting the container, create a web.xml file in the WEB-INF directory. The final directory structure is shown below:
installdir
apps\
servlets\
myapp\
WEB-INF\
web.xml
In this example, the servlets directory contains a single context directory named myapp. At Agent startup, the container is initialized and creates a context named myapp and configures the context as specified in the <installdir>\apps\servlets\myapp\WEB-INF\web.xml file.
The servlets directory may contain any number of servlet contexts. Each context contains static Web pages and/or servlet definitions. Each context must also have its own web.xml file, describing which servlets are available within that context. Such a collection of contexts can be considered a Web application.
NOTE >> If using an external Web server, it must be configured to forward requests for the new context. See “Forward Requests From a Web Server” for details.
A HydraExpress web.xml file closely resembles a Java servlet web.xml file. The root element of the file is the web-app element, as shown below:
 
<web-app>
<!-- configuration goes here -->
</web-app>
All other configuration elements within the file must appear within the web-app element. The rest of this chapter covers the contents of the context web.xml file in detail.