|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet org.apache.catalina.servlets.ManagerServlet
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:
docBase
attribute
of the context configuration file is used to locate the actual
WAR or directory containing the application.{config-url}
, overriding the
docBase
attribute with the contents of the web
application archive found at {war-url}
./xxx
, based
on the contents of the web application archive found at the
specified URL.path:status:sessions
.
Where path is the context path. Status is either running or stopped.
Sessions is the number of active Sessions./xxx
for this virtual host.users
resource reference.
/xxx
for this
virtual host./xxx
for this virtual host./xxx
for this virtual host./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:
JarURLConnection
class for a
reference to an entire JAR file.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:
Field Summary | |
protected Context |
context
The Context container associated with our web application. |
protected int |
debug
The debugging detail level for this servlet. |
protected java.io.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 Deployer |
deployer
The Deployer container that contains our own web application's Context, along with the associated Contexts for web applications that we are managing. |
protected javax.naming.Context |
global
The global JNDI NamingContext for this server,
if available. |
protected static StringManager |
sm
The string manager for this package. |
protected Wrapper |
wrapper
The Wrapper container associated with this servlet. |
Constructor Summary | |
ManagerServlet()
|
Method Summary | |
protected void |
deploy(java.io.PrintWriter writer,
java.lang.String path,
javax.servlet.http.HttpServletRequest request)
Deploy a web application archive (included in the current request) at the specified context path. |
void |
destroy()
Finalize this servlet. |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Process a GET request for the specified resource. |
void |
doPut(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Process a PUT request for the specified resource. |
protected void |
extractXml(java.io.File war,
java.io.File xml)
Extract the context configuration file from the specified WAR, if it is present. |
protected java.lang.Object |
getLock()
Obtain an object to lock on to prevent this servlet and the HostConfig thread both trying to deploy the same application. |
Wrapper |
getWrapper()
Return the Wrapper with which we are associated. |
void |
init()
Initialize this servlet. |
protected void |
install(java.io.PrintWriter writer,
java.lang.String config,
java.lang.String path,
java.lang.String war)
Install an application for the specified path from the specified web application archive. |
protected void |
list(java.io.PrintWriter writer)
Render a list of the currently active Contexts in our virtual host. |
protected void |
printResources(java.io.PrintWriter writer,
java.lang.String prefix,
javax.naming.Context namingContext,
java.lang.String type,
java.lang.Class clazz)
List the resources of the given context. |
protected void |
reload(java.io.PrintWriter writer,
java.lang.String path)
Reload the web application at the specified context path. |
protected void |
remove(java.io.PrintWriter writer,
java.lang.String path)
Remove the web application at the specified context path. |
protected void |
resources(java.io.PrintWriter writer,
java.lang.String type)
Render a list of available global JNDI resources. |
protected void |
roles(java.io.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 void |
serverinfo(java.io.PrintWriter writer)
Writes System OS and JVM properties. |
protected void |
sessions(java.io.PrintWriter writer,
java.lang.String path)
Session information for the web application at the specified context path. |
void |
setWrapper(Wrapper wrapper)
Set the Wrapper with which we are associated. |
protected void |
start(java.io.PrintWriter writer,
java.lang.String path)
Start the web application at the specified context path. |
protected void |
stop(java.io.PrintWriter writer,
java.lang.String path)
Stop the web application at the specified context path. |
protected void |
undeploy(java.io.PrintWriter writer,
java.lang.String path)
Undeploy the web application at the specified context path. |
protected void |
undeployDir(java.io.File dir)
Delete the specified directory, including all of its contents and subdirectories recursively. |
protected void |
uploadWar(javax.servlet.http.HttpServletRequest request,
java.io.File war)
Upload the WAR file included in this request, and store it at the specified file location. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPost, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Context context
protected int debug
protected java.io.File deployed
protected Deployer deployer
protected javax.naming.Context global
NamingContext
for this server,
if available.
protected static StringManager sm
protected Wrapper wrapper
Constructor Detail |
public ManagerServlet()
Method Detail |
public Wrapper getWrapper()
getWrapper
in interface ContainerServlet
public void setWrapper(Wrapper wrapper)
setWrapper
in interface ContainerServlet
wrapper
- The new wrapperpublic void destroy()
destroy
in interface javax.servlet.Servlet
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
request
- The servlet request we are processingresponse
- The servlet response we are creating
java.io.IOException
- if an input/output error occurs
javax.servlet.ServletException
- if a servlet-specified error occurspublic void doPut(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
request
- The servlet request we are processingresponse
- The servlet response we are creating
java.io.IOException
- if an input/output error occurs
javax.servlet.ServletException
- if a servlet-specified error occurspublic void init() throws javax.servlet.ServletException
javax.servlet.ServletException
protected void deploy(java.io.PrintWriter writer, java.lang.String path, javax.servlet.http.HttpServletRequest request)
writer
- Writer to render results topath
- Context path of the application to be installedrequest
- Servlet request we are processingprotected void install(java.io.PrintWriter writer, java.lang.String config, java.lang.String path, java.lang.String war)
writer
- Writer to render results toconfig
- URL of the context configuration file to be installedpath
- Context path of the application to be installedwar
- URL of the web application archive to be installedprotected void list(java.io.PrintWriter writer)
writer
- Writer to render toprotected void reload(java.io.PrintWriter writer, java.lang.String path)
writer
- Writer to render topath
- Context path of the application to be restartedprotected void remove(java.io.PrintWriter writer, java.lang.String path)
writer
- Writer to render topath
- Context path of the application to be removedprotected void resources(java.io.PrintWriter writer, java.lang.String type)
type
- Fully qualified class name of the resource type of interest,
or null
to list resources of all typesprotected void printResources(java.io.PrintWriter writer, java.lang.String prefix, javax.naming.Context namingContext, java.lang.String type, java.lang.Class clazz)
protected void roles(java.io.PrintWriter writer)
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.
writer
- Writer to render toprotected void serverinfo(java.io.PrintWriter writer)
writer
- Writer to render toprotected void sessions(java.io.PrintWriter writer, java.lang.String path)
writer
- Writer to render topath
- Context path of the application to list session information forprotected void start(java.io.PrintWriter writer, java.lang.String path)
writer
- Writer to render topath
- Context path of the application to be startedprotected void stop(java.io.PrintWriter writer, java.lang.String path)
writer
- Writer to render topath
- Context path of the application to be stoppedprotected void undeploy(java.io.PrintWriter writer, java.lang.String path)
writer
- Writer to render topath
- Context path of the application to be removedprotected void extractXml(java.io.File war, java.io.File xml) throws java.io.IOException
war
- File object representing the WARxml
- File object representing where to store the extracted
context configuration file (if it exists)
java.io.IOException
- if an i/o error occursprotected void undeployDir(java.io.File dir)
dir
- File object representing the directory to be deletedprotected void uploadWar(javax.servlet.http.HttpServletRequest request, java.io.File war) throws java.io.IOException
request
- The servlet request we are processingwar
- The file into which we should store the uploaded WAR
java.io.IOException
- if an I/O error occurs during processingprotected java.lang.Object getLock()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |