Adding a Context

The Context element in the server.xml file represents a web module that executes within a particular host. The web module used to process each HTTP request is selected based on matching the longest possible prefix of the Request URI against the context path of each defined Context. You can define an unlimited number of Context elements within a particular Host. Each Context must have a unique context path.

A Context is created when a web module is executed or deployed from within the IDE. The Context Root property value, set on the WEB-INF property sheet, is used to generate the context path name within the web server. The corresponding context element is added automatically to the appropriate server.xml file. Typically, you do not need to create contexts explicitly.

To add a Context:

  1. On the Runtime tab of the Explorer, expand the Installed Servers node.
  2. Expand the Tomcat 4.0.x node, then expand the node for the relevant installation.
  3. Right-click on the node representing the Host to which you want to add a Context, then choose Add Context from the contextual menu.
  4. In the Add Context dialog box, select the appropriate web module, then enter a unique path in the Context Path field.
  5. Click OK.

A new Context node appears under its Host on the Runtime tab in the Explorer. Using the contextual menu for this node, you can set properties for the Context.

See also
Tomcat 4.0.x Context Node
Setting Context Properties
Deleting a Context

Legal Notices