| javax.servlet.http.HttpServlet org.apache.catalina.manager.ManagerServlet
All known Subclasses: org.apache.catalina.manager.HTMLManagerServlet,
ManagerServlet | public class ManagerServlet extends HttpServlet implements ContainerServlet(Code) | | Servlet that enables remote management of the web applications installed
within the same virtual host as this web application is. 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:
- /deploy?config={config-url} - Install and start a new
web application, based on the contents of the context configuration
file found at the specified URL. The
docBase attribute
of the context configuration file is used to locate the actual
WAR or directory containing the application.
- /deploy?config={config-url}&war={war-url}/ - Install and start
a new web application, based on the contents of the context
configuration file found at
{config-url} , overriding the
docBase attribute with the contents of the web
application archive found at {war-url} .
- /deploy?path=/xxx&war={war-url} - Install and start a new
web application attached to context path
/xxx , based
on the contents of the web application archive found at the
specified URL.
- /list - List the context paths of all currently installed web
applications for this virtual host. Each context will be listed with
the following format
path:status:sessions .
Where path is the context path. Status is either running or stopped.
Sessions is the number of active Sessions.
- /reload?path=/xxx - Reload the Java classes and resources for
the application at the specified path.
- /resources?type=xxxx - Enumerate the available global JNDI
resources, optionally limited to those of the specified type
(fully qualified Java class name), if available.
- /roles - Enumerate the available security role names and
descriptions from the user database connected to the
users
resource reference.
- /serverinfo - Display system OS and JVM properties.
- /expire?path=/xxx - List session idle timeinformation about the
web application attached to context path
/xxx for this
virtual host.
- /expire?path=/xxx&idle=mm - Expire sessions
for the context path
/xxx which were idle for at
least mm minutes.
- /start?path=/xxx - Start the web application attached to
context path
/xxx for this virtual host.
- /stop?path=/xxx - Stop the web application attached to
context path
/xxx for this virtual host.
- /undeploy?path=/xxx - Shutdown and remove the web application
attached to context path
/xxx for this virtual host,
and remove the underlying WAR file or document base directory.
(NOTE - This is only allowed if the WAR file or document
base is stored in the appBase directory of this host,
typically as a result of being placed there via the /deploy
command.
Use path=/ for the ROOT context.
The syntax of the URL for a web application archive must conform to one
of the following patterns to be successfully deployed:
- file:/absolute/path/to/a/directory - You can specify the absolute
path of a directory that contains the unpacked version of a web
application. This directory will be attached to the context path you
specify without any changes.
- jar:file:/absolute/path/to/a/warfile.war!/ - You can specify a
URL to a local web application archive file. The syntax must conform to
the rules specified by the
JarURLConnection class for a
reference to an entire JAR file.
- jar:http://hostname:port/path/to/a/warfile.war!/ - You can specify
a URL to a remote (HTTP-accessible) web application archive file. The
syntax must conform to the rules specified by the
JarURLConnection class for a reference to an entire
JAR file.
NOTE - Attempting to reload or remove the application containing
this servlet itself will not succeed. Therefore, this servlet should
generally be deployed as a separate web application within the virtual host
to be managed.
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:
- debug - The debugging detail level that controls the amount
of information that is logged by this servlet. Default is zero.
author: Craig R. McClanahan author: Remy Maucherat version: $Revision: 532461 $ $Date: 2007-04-25 21:56:25 +0200 (mer., 25 avr. 2007) $ |
Field Summary | |
protected File | appBase The host appBase. | protected File | configBase Path where context descriptors should be deployed. | protected Context | context The Context container associated with our web application. | protected File | contextDescriptors Path used to store context descriptors. | protected int | debug The debugging detail level for this servlet. | protected File | deployed File object representing the directory into which the deploy() command
will store the WAR and context configuration files that have been
uploaded. | protected javax.naming.Context | global The global JNDI NamingContext for this server,
if available. | protected Host | host The associated host. | protected MBeanServer | mBeanServer MBean server. | protected ObjectName | oname The associated deployer ObjectName. | protected static StringManager | sm The string manager for this package. | protected File | versioned Path used to store revisions of webapps. | protected Wrapper | wrapper The Wrapper container associated with this servlet. |
Method Summary | |
protected void | addServiced(String name) Invoke the addServiced method on the deployer. | protected void | check(String name) Invoke the check method on the deployer. | public static boolean | copy(File src, File dest) Copy the specified file or directory to the destination. | public static boolean | copyInternal(File src, File dest, byte[] buf) Copy the specified file or directory to the destination. | protected synchronized void | deploy(PrintWriter writer, String path, String tag, boolean update, HttpServletRequest request) Deploy a web application archive (included in the current request)
at the specified context path. | protected void | deploy(PrintWriter writer, String path, String tag) Install an application for the specified path from the specified
web application archive. | protected void | deploy(PrintWriter writer, String config, String path, String war, boolean update) Install an application for the specified path from the specified
web application archive. | public void | destroy() Finalize this servlet. | public void | doGet(HttpServletRequest request, HttpServletResponse response) Process a GET request for the specified resource. | public void | doPut(HttpServletRequest request, HttpServletResponse response) Process a PUT request for the specified resource. | protected void | expireSessions(PrintWriter writer, String path, HttpServletRequest req) | protected File | getAppBase() Return a File object representing the "application root" directory
for our associated Host. | protected String | getConfigFile(String path) Given a context path, get the config file name. | protected String | getDocBase(String path) Given a context path, get the config file name. | public Wrapper | getWrapper() Return the Wrapper with which we are associated. | public void | init() Initialize this servlet. | protected boolean | isDeployed(String name) Invoke the isDeployed method on the deployer. | protected boolean | isServiced(String name) Invoke the isServiced method on the deployer. | protected void | list(PrintWriter writer) Render a list of the currently active Contexts in our virtual host. | protected void | printResources(PrintWriter writer, String prefix, javax.naming.Context namingContext, String type, Class clazz) List the resources of the given context. | protected void | reload(PrintWriter writer, String path) Reload the web application at the specified context path. | protected void | removeServiced(String name) Invoke the removeServiced method on the deployer. | protected void | resources(PrintWriter writer, String type) Render a list of available global JNDI resources. | protected void | roles(PrintWriter writer) Render a list of security role names (and corresponding descriptions)
from the org.apache.catalina.UserDatabase resource that is
connected to the users resource reference. | protected synchronized void | save(PrintWriter writer, String path) Store server configuration. | protected void | serverinfo(PrintWriter writer) Writes System OS and JVM properties. | protected void | sessions(PrintWriter writer, String path, int idle) Session information for the web application at the specified context path. | protected void | sessions(PrintWriter writer, String path) Session information for the web application at the specified context path. | public void | setWrapper(Wrapper wrapper) Set the Wrapper with which we are associated. | protected void | start(PrintWriter writer, String path) Start the web application at the specified context path. | protected void | stop(PrintWriter writer, String path) Stop the web application at the specified context path. | protected void | undeploy(PrintWriter writer, String path) Undeploy the web application at the specified context path. | protected void | undeployDir(File dir) Delete the specified directory, including all of its contents and
subdirectories recursively. | protected void | uploadWar(HttpServletRequest request, File war) Upload the WAR file included in this request, and store it at the
specified file location. |
appBase | protected File appBase(Code) | | The host appBase.
|
configBase | protected File configBase(Code) | | Path where context descriptors should be deployed.
|
context | protected Context context(Code) | | The Context container associated with our web application.
|
contextDescriptors | protected File contextDescriptors(Code) | | Path used to store context descriptors.
|
debug | protected int debug(Code) | | The debugging detail level for this servlet.
|
deployed | protected File deployed(Code) | | File object representing the directory into which the deploy() command
will store the WAR and context configuration files that have been
uploaded.
|
host | protected Host host(Code) | | The associated host.
|
versioned | protected File versioned(Code) | | Path used to store revisions of webapps.
|
wrapper | protected Wrapper wrapper(Code) | | The Wrapper container associated with this servlet.
|
addServiced | protected void addServiced(String name) throws Exception(Code) | | Invoke the addServiced method on the deployer.
|
copy | public static boolean copy(File src, File dest)(Code) | | Copy the specified file or directory to the destination.
Parameters: src - File object representing the source Parameters: dest - File object representing the destination |
copyInternal | public static boolean copyInternal(File src, File dest, byte[] buf)(Code) | | Copy the specified file or directory to the destination.
Parameters: src - File object representing the source Parameters: dest - File object representing the destination |
deploy | protected synchronized void deploy(PrintWriter writer, String path, String tag, boolean update, HttpServletRequest request)(Code) | | Deploy a web application archive (included in the current request)
at the specified context path.
Parameters: writer - Writer to render results to Parameters: path - Context path of the application to be installed Parameters: tag - Tag to be associated with the webapp Parameters: request - Servlet request we are processing |
deploy | protected void deploy(PrintWriter writer, String path, String tag)(Code) | | Install an application for the specified path from the specified
web application archive.
Parameters: writer - Writer to render results to Parameters: tag - Revision tag to deploy from Parameters: path - Context path of the application to be installed |
deploy | protected void deploy(PrintWriter writer, String config, String path, String war, boolean update)(Code) | | Install an application for the specified path from the specified
web application archive.
Parameters: writer - Writer to render results to Parameters: config - URL of the context configuration file to be installed Parameters: path - Context path of the application to be installed Parameters: war - URL of the web application archive to be installed Parameters: update - true to override any existing webapp on the path |
destroy | public void destroy()(Code) | | Finalize this servlet.
|
getAppBase | protected File getAppBase()(Code) | | Return a File object representing the "application root" directory
for our associated Host.
|
getConfigFile | protected String getConfigFile(String path)(Code) | | Given a context path, get the config file name.
|
getDocBase | protected String getDocBase(String path)(Code) | | Given a context path, get the config file name.
|
getWrapper | public Wrapper getWrapper()(Code) | | Return the Wrapper with which we are associated.
|
isDeployed | protected boolean isDeployed(String name) throws Exception(Code) | | Invoke the isDeployed method on the deployer.
|
isServiced | protected boolean isServiced(String name) throws Exception(Code) | | Invoke the isServiced method on the deployer.
|
list | protected void list(PrintWriter writer)(Code) | | Render a list of the currently active Contexts in our virtual host.
Parameters: writer - Writer to render to |
reload | protected void reload(PrintWriter writer, String path)(Code) | | Reload the web application at the specified context path.
Parameters: writer - Writer to render to Parameters: path - Context path of the application to be restarted |
removeServiced | protected void removeServiced(String name) throws Exception(Code) | | Invoke the removeServiced method on the deployer.
|
resources | protected void resources(PrintWriter writer, String type)(Code) | | Render a list of available global JNDI resources.
Parameters: type - Fully qualified class name of the resource type of interest,or null to list resources of all types |
roles | protected void roles(PrintWriter writer)(Code) | | Render a list of security role names (and corresponding descriptions)
from the org.apache.catalina.UserDatabase resource that is
connected to the users resource reference. Typically, this
will be the global user database, but can be adjusted if you have
different user databases for different virtual hosts.
Parameters: writer - Writer to render to |
save | protected synchronized void save(PrintWriter writer, String path)(Code) | | Store server configuration.
Parameters: path - Optional context path to save |
serverinfo | protected void serverinfo(PrintWriter writer)(Code) | | Writes System OS and JVM properties.
Parameters: writer - Writer to render to |
sessions | protected void sessions(PrintWriter writer, String path, int idle)(Code) | | Session information for the web application at the specified context path.
Displays a profile of session lastAccessedTime listing number
of sessions for each 10 minute interval up to 10 hours.
Parameters: writer - Writer to render to Parameters: path - Context path of the application to list session information for Parameters: idle - Expire all sessions with idle time ≥ idle for this context |
sessions | protected void sessions(PrintWriter writer, String path)(Code) | | Session information for the web application at the specified context path.
Displays a profile of session lastAccessedTime listing number
of sessions for each 10 minute interval up to 10 hours.
Parameters: writer - Writer to render to Parameters: path - Context path of the application to list session information for |
setWrapper | public void setWrapper(Wrapper wrapper)(Code) | | Set the Wrapper with which we are associated.
Parameters: wrapper - The new wrapper |
start | protected void start(PrintWriter writer, String path)(Code) | | Start the web application at the specified context path.
Parameters: writer - Writer to render to Parameters: path - Context path of the application to be started |
stop | protected void stop(PrintWriter writer, String path)(Code) | | Stop the web application at the specified context path.
Parameters: writer - Writer to render to Parameters: path - Context path of the application to be stopped |
undeploy | protected void undeploy(PrintWriter writer, String path)(Code) | | Undeploy the web application at the specified context path.
Parameters: writer - Writer to render to Parameters: path - Context path of the application to be removed |
undeployDir | protected void undeployDir(File dir)(Code) | | Delete the specified directory, including all of its contents and
subdirectories recursively.
Parameters: dir - File object representing the directory to be deleted |
uploadWar | protected void uploadWar(HttpServletRequest request, File war) throws IOException(Code) | | Upload the WAR file included in this request, and store it at the
specified file location.
Parameters: request - The servlet request we are processing Parameters: war - The file into which we should store the uploaded WAR exception: IOException - if an I/O error occurs during processing |
Methods inherited from javax.servlet.http.HttpServlet | protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected void doTrace(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) protected long getLastModified(HttpServletRequest req)(Code)(Java Doc) protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException(Code)(Java Doc) public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException(Code)(Java Doc)
|
|
|