Chapter 4 Configuring Objects in the Servlet Container
Introduction
Each servlet, filter, and listener in the servlet container exists within a context. This chapter describes the tasks involved in creating a new context and configuring a context.
Each servlet and each filter must have a URL pattern mapping, and may have initialization parameters.
“Servlet and Filter Initialization Parameters” discusses initialization parameters.
“URL Patterns” explains URL pattern matching. The remainder of the chapter, beginning with
“Deploy the Compiled Object Files” , describes tasks associated with adding a context, as summarized in the next section.
Procedure for Adding a Context
The list below describes the tasks that could be involved in adding a servlet context. The first two tasks, deploying the libraries needed by the context and creating a context directory, are required for all contexts. The other tasks may or may not be required depending on the needs of the context. For example, if no servlets or filters in the context depend on context parameters, there is no need to add parameters to the context.
To add a context:
• Deploy the files that contain the compiled servlets, filters, and listeners that the context will contain (
“Deploy the Compiled Object Files” ). All contexts require this step.
• Create a context directory that contains a
WEB-INF directory and create a
web.xml file within the
WEB-INF directory (
“Create a Context Directory” ). All contexts require this step.
To activate a new context, it must be loaded into the HydraExpress Agent. This is done simply by stopping and restarting the Agent, as described in Chapter 4, “Agent Administration,” of the HydraExpress User Guide. The Agent reports unrecoverable errors to the console. Errors defined in the context web.xml file are written to the Agent log, assuming the Agent has logging enabled.
Procedure for Adding a Servlet
To add a servlet to an existing context, follow the steps below:
Stop and restart the Agent to load the servlet.
Procedure for Adding a Filter
To add a filter to an existing context, follow the steps below:
Stop and restart the Agent to load the servlet and its associated filter.
Procedure for Adding a Listener
To add a listener to an existing context, follow the steps below:
Stop and restart the Agent to load the servlet and its associated listener.