Class HostManagerServlet

All Implemented Interfaces:
Servlet, ServletConfig, Serializable, ContainerServlet
Direct Known Subclasses:

public class HostManagerServlet extends HttpServlet implements ContainerServlet
Servlet that enables remote management of the virtual hosts installed on the server. Normally, this functionality will be protected by a security constraint in the web application deployment descriptor. However, this requirement can be relaxed during testing.

This servlet examines the value returned by getPathInfo() and related query parameters to determine what action is being requested. The following actions and parameters (starting after the servlet path) are supported:

  • /add?name={host-name}&aliases={host-aliases}&manager={manager} - Create and add a new virtual host. The host-name attribute indicates the name of the new host. The host-aliases attribute is a comma separated list of the host alias names. The manager attribute is a boolean value indicating if the webapp manager will be installed in the newly created host (optional, false by default).
  • /remove?name={host-name} - Remove a virtual host. The host-name attribute indicates the name of the host.
  • /list - List the virtual hosts installed on the server. Each host will be listed with the following format host-name#host-aliases.
  • /start?name={host-name} - Start the virtual host.
  • /stop?name={host-name} - Stop the virtual host.

NOTE - Attempting to stop or remove the host containing this servlet itself will not succeed. Therefore, this servlet should generally be deployed in a separate virtual host.

The following servlet initialization parameters are recognized:

  • debug - The debugging detail level that controls the amount of information that is logged by this servlet. Default is zero.
Craig R. McClanahan, Remy Maucherat
See Also: