Contexts
The servlet container can manage any number of distinct applications. A C++ application consists of any number of servlets, filters, listeners, and static Web pages. A set of components working together is a web application. The servlet container uses a context to group related components. The container loads the objects within a context as a group, and objects within the same context can easily share data. Therefore, each context usually corresponds to a distinct Web application.
At servlet execution runtime, all servlet context directories must be deployed to the servlet deployment directory, <installdir>\apps\servlets. Each directory within the servlets directory defines a context. The name of the context directory is the name of the context and determines the path to the servlets within the context. Each context directory contains a WEB-INF directory, and may also contain files related to the application. Each WEB-INF directory contains a web.xml file. The web.xml file describes the configuration of the context and the servlets, filters, and listeners that occupy the context.
For example, the directory structure below describes two contexts, one named orders and one named catalog. The catalog context contains a static HTML page, intro.html.
hydraexpress-installdir
\apps
\servlets
\orders
\WEB-INF
web.xml
\catalog
intro.html
\WEB-INF
web.xml
If the HydraExpress Agent is at http://example.com, an HTML page at <installdir>\apps\servlets\catalog\intro.html appears at the URL http://example.com/servlets/catalog/intro.html. Likewise, servlets defined in the <installdir>\apps\servlets\orders\WEB-INF\web.xml file appear at URLs underneath http://example.com/orders.
For details on creating contexts and deploying servlets within contexts, see
Chapter 4, Configuring Objects in the Servlet Container.