org.apache.catalina.manager.host

Class HostManagerServlet

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:

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.

NOTE - For security reasons, this application will not operate when accessed via the invoker servlet. You must explicitly map this servlet with a servlet mapping, and you will always want to protect it with appropriate security constraints as well.

The following servlet initialization parameters are recognized:

Version: $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $

Author: Craig R. McClanahan Remy Maucherat

Field Summary
protected FileconfigBase
Path where context descriptors should be deployed.
protected Contextcontext
The Context container associated with our web application.
protected intdebug
The debugging detail level for this servlet.
protected Engineengine
The associated engine.
protected Hosthost
The associated host.
protected MBeanServermBeanServer
MBean server.
protected static StringManagersm
The string manager for this package.
protected Wrapperwrapper
The Wrapper container associated with this servlet.
Method Summary
protected voidadd(HttpServletRequest request, PrintWriter writer, String name, boolean htmlMode)
Add host with the given parameters.
protected voidadd(PrintWriter writer, String name, String aliases, String appBase, boolean manager, boolean autoDeploy, boolean deployOnStartup, boolean deployXML, boolean unpackWARs, boolean xmlNamespaceAware, boolean xmlValidation)
Add a host using the specified parameters.
protected booleanbooleanParameter(HttpServletRequest request, String parameter, boolean theDefault, boolean htmlMode)
extract boolean value from checkbox with default
voiddestroy()
Finalize this servlet.
voiddoGet(HttpServletRequest request, HttpServletResponse response)
Process a GET request for the specified resource.
protected FilegetConfigBase(String hostName)
Get config base.
WrappergetWrapper()
Return the Wrapper with which we are associated.
voidinit()
Initialize this servlet.
protected voidlist(PrintWriter writer)
Render a list of the currently active Contexts in our virtual host.
protected voidremove(PrintWriter writer, String name)
Remove the specified host.
voidsetWrapper(Wrapper wrapper)
Set the Wrapper with which we are associated.
protected voidstart(PrintWriter writer, String name)
Start the host with the specified name.
protected voidstop(PrintWriter writer, String name)
Start the host with the specified name.

Field Detail

configBase

protected File configBase
Path where context descriptors should be deployed.

context

protected Context context
The Context container associated with our web application.

debug

protected int debug
The debugging detail level for this servlet.

engine

protected Engine engine
The associated engine.

host

protected Host host
The associated host.

mBeanServer

protected MBeanServer mBeanServer
MBean server.

sm

protected static StringManager sm
The string manager for this package.

wrapper

protected Wrapper wrapper
The Wrapper container associated with this servlet.

Method Detail

add

protected void add(HttpServletRequest request, PrintWriter writer, String name, boolean htmlMode)
Add host with the given parameters.

Parameters: request The request writer The output writer name The host name htmlMode Flag value

add

protected void add(PrintWriter writer, String name, String aliases, String appBase, boolean manager, boolean autoDeploy, boolean deployOnStartup, boolean deployXML, boolean unpackWARs, boolean xmlNamespaceAware, boolean xmlValidation)
Add a host using the specified parameters.

Parameters: writer Writer to render results to name host name aliases comma separated alias list appBase application base for the host manager should the manager webapp be deployed to the new host ?

booleanParameter

protected boolean booleanParameter(HttpServletRequest request, String parameter, boolean theDefault, boolean htmlMode)
extract boolean value from checkbox with default

Parameters: request parameter theDefault htmlMode

Returns:

destroy

public void destroy()
Finalize this servlet.

doGet

public void doGet(HttpServletRequest request, HttpServletResponse response)
Process a GET request for the specified resource.

Parameters: request The servlet request we are processing response The servlet response we are creating

Throws: IOException if an input/output error occurs ServletException if a servlet-specified error occurs

getConfigBase

protected File getConfigBase(String hostName)
Get config base.

getWrapper

public Wrapper getWrapper()
Return the Wrapper with which we are associated.

init

public void init()
Initialize this servlet.

list

protected void list(PrintWriter writer)
Render a list of the currently active Contexts in our virtual host.

Parameters: writer Writer to render to

remove

protected void remove(PrintWriter writer, String name)
Remove the specified host.

Parameters: writer Writer to render results to name host name

setWrapper

public void setWrapper(Wrapper wrapper)
Set the Wrapper with which we are associated.

Parameters: wrapper The new wrapper

start

protected void start(PrintWriter writer, String name)
Start the host with the specified name.

Parameters: writer Writer to render to name Host name

stop

protected void stop(PrintWriter writer, String name)
Start the host with the specified name.

Parameters: writer Writer to render to name Host name

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.