Class ManagerServlet
- All Implemented Interfaces:
- Serializable,- Servlet,- ServletConfig,- ContainerServlet
- Direct Known Subclasses:
- HTMLManagerServlet
 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 docBaseattribute 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 thedocBaseattribute 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.
- /serverinfo - Display system OS and JVM properties.
- /sessions - Deprecated. Use expire.
- /expire?path=/xxx - List session idle time information about the web application attached to context path
 /xxxfor this virtual host.
- /expire?path=/xxx&idle=mm - Expire sessions for the context path /xxxwhich were idle for at least mm minutes.
- /sslConnectorCiphers - Display diagnostic info on SSL/TLS ciphers that are currently configured for each connector.
- /start?path=/xxx - Start the web application attached to context path /xxxfor this virtual host.
- /stop?path=/xxx - Stop the web application attached to context path /xxxfor this virtual host.
- /threaddump - Write a JVM thread dump.
- /undeploy?path=/xxx - Shutdown and remove the web application attached to context path /xxxfor 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 theappBasedirectory of this host, typically as a result of being placed there via the/deploycommand.
- /vminfo - Write some VM info.
- /save - Save the current server configuration to server.xml
- /save?path=/xxx - Save the context configuration for the web application deployed with path
 /xxxto an appropriately named context.xml file in thexmlBasefor the associated Host.
 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.
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.
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, Remy Maucherat
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected FilePath where context descriptors should be deployed.protected ContextThe Context container associated with our web application.protected intThe debugging detail level for this servlet.protected ContextThe global JNDINamingContextfor this server, if available.protected HostThe associated host.protected MBeanServerMBean server.protected ObjectNameThe associated deployer ObjectName.protected static final StringManagerThe string manager for this package.protected FilePath used to store revisions of webapps.protected WrapperThe Wrapper container associated with this servlet.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaddServiced(String name) Deprecated.Unused.protected voidInvoke the check method on the deployer.protected voiddeploy(PrintWriter writer, String config, ContextName cn, String tag, boolean update, HttpServletRequest request, StringManager smClient) Deploy a web application archive (included in the current request) at the specified context path.protected voiddeploy(PrintWriter writer, String config, ContextName cn, String war, boolean update, StringManager smClient) Install an application for the specified path from the specified web application archive.protected voiddeploy(PrintWriter writer, ContextName cn, String tag, StringManager smClient) Install an application for the specified path from the specified web application archive.voiddestroy()Called by the servlet container to indicate to a servlet that the servlet is being taken out of service.voiddoGet(HttpServletRequest request, HttpServletResponse response) Called by the server (via theservicemethod) to allow a servlet to handle a GET request.voiddoPut(HttpServletRequest request, HttpServletResponse response) Called by the server (via theservicemethod) to allow a servlet to handle a PUT request.protected voidexpireSessions(PrintWriter writer, ContextName cn, HttpServletRequest req, StringManager smClient) Extract the expiration request parameterprotected voidfindleaks(boolean statusLine, PrintWriter writer, StringManager smClient) Find potential memory leaks caused by web application reload.getConnectorCerts(StringManager smClient) getConnectorCiphers(StringManager smClient) getConnectorTrustedCerts(StringManager smClient) Obtain the Wrapper with which this Servlet is associated.voidinit()A convenience method which can be overridden so that there's no need to callsuper.init(config).protected booleanisDeployed(String name) Invoke the isDeployed method on the deployer.protected booleanisServiced(String name) Deprecated.Unused.protected voidlist(PrintWriter writer, StringManager smClient) Render a list of the currently active Contexts in our virtual host.protected voidprintResources(PrintWriter writer, String prefix, Context namingContext, String type, Class<?> clazz, StringManager smClient) Deprecated.UseprintResources(PrintWriter, String, javax.naming.Context, String, StringManager)This method will be removed in Tomcat 10.x onwardsprotected voidprintResources(PrintWriter writer, String prefix, Context namingContext, String type, StringManager smClient) List the resources of the given context.protected voidreload(PrintWriter writer, ContextName cn, StringManager smClient) Reload the web application at the specified context path.protected voidremoveServiced(String name) Invoke the removeServiced method on the deployer.protected voidresources(PrintWriter writer, String type, StringManager smClient) Render a list of available global JNDI resources.protected voidsave(PrintWriter writer, String path, StringManager smClient) Store server configuration.protected voidserverinfo(PrintWriter writer, StringManager smClient) Writes System OS and JVM properties.protected voidsessions(PrintWriter writer, ContextName cn, int idle, StringManager smClient) Session information for the web application at the specified context path.voidsetWrapper(Wrapper wrapper) Set the Wrapper with which this Servlet is associated.protected voidsslConnectorCiphers(PrintWriter writer, StringManager smClient) protected voidsslReload(PrintWriter writer, String tlsHostName, StringManager smClient) protected voidstart(PrintWriter writer, ContextName cn, StringManager smClient) Start the web application at the specified context path.protected voidstop(PrintWriter writer, ContextName cn, StringManager smClient) Stop the web application at the specified context path.protected voidthreadDump(PrintWriter writer, StringManager smClient, Enumeration<Locale> requestedLocales) Write a JVM thread dump.protected booleantryAddServiced(String name) Attempt to mark a context as being servicedprotected voidundeploy(PrintWriter writer, ContextName cn, StringManager smClient) Undeploy the web application at the specified context path.protected voiduploadWar(PrintWriter writer, HttpServletRequest request, File war, StringManager smClient) Upload the WAR file included in this request, and store it at the specified file location.protected static booleanvalidateContextName(ContextName cn, PrintWriter writer, StringManager smClient) protected voidvmInfo(PrintWriter writer, StringManager smClient, Enumeration<Locale> requestedLocales) Write some VM info.Methods inherited from class javax.servlet.http.HttpServletdoDelete, doHead, doOptions, doPost, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServletgetInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
- 
Field Details- 
configBasePath where context descriptors should be deployed.
- 
contextThe Context container associated with our web application.
- 
debugprotected int debugThe debugging detail level for this servlet.
- 
versionedPath used to store revisions of webapps.
- 
hostThe associated host.
- 
mBeanServerMBean server.
- 
onameThe associated deployer ObjectName.
- 
globalThe global JNDINamingContextfor this server, if available.
- 
smThe string manager for this package.
- 
wrapperThe Wrapper container associated with this servlet.
 
- 
- 
Constructor Details- 
ManagerServletpublic ManagerServlet()
 
- 
- 
Method Details- 
getWrapperDescription copied from interface:ContainerServletObtain the Wrapper with which this Servlet is associated.- Specified by:
- getWrapperin interface- ContainerServlet
- Returns:
- The Wrapper with which this Servlet is associated.
 
- 
setWrapperDescription copied from interface:ContainerServletSet the Wrapper with which this Servlet is associated.- Specified by:
- setWrapperin interface- ContainerServlet
- Parameters:
- wrapper- The new associated Wrapper
 
- 
destroypublic void destroy()Description copied from class:javax.servlet.GenericServletCalled by the servlet container to indicate to a servlet that the servlet is being taken out of service. SeeServlet.destroy().- Specified by:
- destroyin interface- Servlet
- Overrides:
- destroyin class- GenericServlet
 
- 
doGetpublic void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException Description copied from class:javax.servlet.http.HttpServletCalled by the server (via theservicemethod) to allow a servlet to handle a GET request.Overriding this method to support a GET request also automatically supports an HTTP HEAD request. A HEAD request is a GET request that returns no body in the response, only the request header fields. When overriding this method, read the request data, write the response headers, get the response's Writer or output stream object, and finally, write the response data. It's best to include content type and encoding. When using a PrintWriterobject to return the response, set the content type before accessing thePrintWriterobject.The servlet container must write the headers before committing the response, because in HTTP the headers must be sent before the response body. Where possible, set the Content-Length header (with the ServletResponse.setContentLength(int)method), to allow the servlet container to use a persistent connection to return its response to the client, improving performance. The content length is automatically set if the entire response fits inside the response buffer.When using HTTP 1.1 chunked encoding (which means that the response has a Transfer-Encoding header), do not set the Content-Length header. The GET method should be safe, that is, without any side effects for which users are held responsible. For example, most form queries have no side effects. If a client request is intended to change stored data, the request should use some other HTTP method. The GET method should also be idempotent, meaning that it can be safely repeated. Sometimes making a method safe also makes it idempotent. For example, repeating queries is both safe and idempotent, but buying a product online or modifying data is neither safe nor idempotent. If the request is incorrectly formatted, doGetreturns an HTTP "Bad Request" message.- Overrides:
- doGetin class- HttpServlet
- Parameters:
- request- an- HttpServletRequestobject that contains the request the client has made of the servlet
- response- an- HttpServletResponseobject that contains the response the servlet sends to the client
- Throws:
- IOException- if an input or output error is detected when the servlet handles the GET request
- ServletException- if the request for the GET could not be handled
- See Also:
 
- 
doPutpublic void doPut(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException Description copied from class:javax.servlet.http.HttpServletCalled by the server (via theservicemethod) to allow a servlet to handle a PUT request. The PUT operation allows a client to place a file on the server and is similar to sending a file by FTP.When overriding this method, leave intact any content headers sent with the request (including Content-Length, Content-Type, Content-Transfer-Encoding, Content-Encoding, Content-Base, Content-Language, Content-Location, Content-MD5, and Content-Range). If your method cannot handle a content header, it must issue an error message (HTTP 501 - Not Implemented) and discard the request. For more information on HTTP 1.1, see RFC 2616 . This method does not need to be either safe or idempotent. Operations that doPutperforms can have side effects for which the user can be held accountable. When using this method, it may be useful to save a copy of the affected URL in temporary storage.If the HTTP PUT request is incorrectly formatted, doPutreturns an HTTP "Bad Request" message.- Overrides:
- doPutin class- HttpServlet
- Parameters:
- request- the- HttpServletRequestobject that contains the request the client made of the servlet
- response- the- HttpServletResponseobject that contains the response the servlet returns to the client
- Throws:
- IOException- if an input or output error occurs while the servlet is handling the PUT request
- ServletException- if the request for the PUT cannot be handled
 
- 
initDescription copied from class:javax.servlet.GenericServletA convenience method which can be overridden so that there's no need to callsuper.init(config).Instead of overriding GenericServlet.init(ServletConfig), simply override this method and it will be called byGenericServlet.init(ServletConfig config). TheServletConfigobject can still be retrieved viaGenericServlet.getServletConfig().- Overrides:
- initin class- GenericServlet
- Throws:
- ServletException- if an exception occurs that interrupts the servlet's normal operation
 
- 
findleaksFind potential memory leaks caused by web application reload.- Parameters:
- statusLine- Print a status line
- writer- The output writer
- smClient- StringManager for the client's locale
 
- 
sslReload
- 
vmInfoprotected void vmInfo(PrintWriter writer, StringManager smClient, Enumeration<Locale> requestedLocales) Write some VM info.- Parameters:
- writer- The output writer
- smClient- StringManager for the client's locale
- requestedLocales- the client's locales
 
- 
threadDumpprotected void threadDump(PrintWriter writer, StringManager smClient, Enumeration<Locale> requestedLocales) Write a JVM thread dump.- Parameters:
- writer- The output writer
- smClient- StringManager for the client's locale
- requestedLocales- the client's locales
 
- 
sslConnectorCiphers
- 
saveStore server configuration.- Parameters:
- writer- Destination for any user message(s) during this operation
- path- Optional context path to save
- smClient- i18n support for current client's locale
 
- 
deployprotected void deploy(PrintWriter writer, String config, ContextName cn, String tag, boolean update, HttpServletRequest request, StringManager smClient) Deploy a web application archive (included in the current request) at the specified context path.- Parameters:
- writer- Writer to render results to
- config- URL of the context configuration file to be installed
- cn- Name of the application to be installed
- tag- Tag to be associated with the webapp
- update- Flag that indicates that any existing app should be replaced
- request- Servlet request we are processing
- smClient- i18n messages using the locale of the client
 
- 
deployInstall an application for the specified path from the specified web application archive.- Parameters:
- writer- Writer to render results to
- tag- Revision tag to deploy from
- cn- Name of the application to be installed
- smClient- i18n messages using the locale of the client
 
- 
deployprotected void deploy(PrintWriter writer, String config, ContextName cn, String war, boolean update, StringManager smClient) Install an application for the specified path from the specified web application archive.- Parameters:
- writer- Writer to render results to
- config- URL of the context configuration file to be installed
- cn- Name of the application to be installed
- war- URL of the web application archive to be installed
- update- true to override any existing webapp on the path
- smClient- i18n messages using the locale of the client
 
- 
listRender a list of the currently active Contexts in our virtual host.- Parameters:
- writer- Writer to render to
- smClient- i18n support for current client's locale
 
- 
reloadReload the web application at the specified context path.- Parameters:
- writer- Writer to render to
- cn- Name of the application to be restarted
- smClient- i18n support for current client's locale
 
- 
resourcesRender a list of available global JNDI resources.- Parameters:
- writer- Writer to render to
- type- Fully qualified class name of the resource type of interest, or- nullto list resources of all types
- smClient- i18n support for current client's locale
 
- 
printResources@Deprecated protected void printResources(PrintWriter writer, String prefix, Context namingContext, String type, Class<?> clazz, StringManager smClient) Deprecated.UseprintResources(PrintWriter, String, javax.naming.Context, String, StringManager)This method will be removed in Tomcat 10.x onwardsList the resources of the given context.- Parameters:
- writer- Writer to render to
- prefix- Path for recursion
- namingContext- The naming context for lookups
- type- Fully qualified class name of the resource type of interest, or- nullto list resources of all types
- clazz- Unused
- smClient- i18n support for current client's locale
 
- 
printResourcesprotected void printResources(PrintWriter writer, String prefix, Context namingContext, String type, StringManager smClient) List the resources of the given context.- Parameters:
- writer- Writer to render to
- prefix- Path for recursion
- namingContext- The naming context for lookups
- type- Fully qualified class name of the resource type of interest, or- nullto list resources of all types
- smClient- i18n support for current client's locale
 
- 
serverinfoWrites System OS and JVM properties.- Parameters:
- writer- Writer to render to
- smClient- i18n support for current client's locale
 
- 
sessionsSession information for the web application at the specified context path. Displays a profile of session thisAccessedTime listing number of sessions for each 10 minute interval up to 10 hours.- Parameters:
- writer- Writer to render to
- cn- Name of the application to list session information for
- idle- Expire all sessions with idle time > idle for this context
- smClient- i18n support for current client's locale
 
- 
expireSessionsprotected void expireSessions(PrintWriter writer, ContextName cn, HttpServletRequest req, StringManager smClient) Extract the expiration request parameter- Parameters:
- writer- Writer to render to
- cn- Name of the application to list session information for
- req- The Servlet request
- smClient- i18n support for current client's locale
 
- 
startStart the web application at the specified context path.- Parameters:
- writer- Writer to render to
- cn- Name of the application to be started
- smClient- i18n support for current client's locale
 
- 
stopStop the web application at the specified context path.- Parameters:
- writer- Writer to render to
- cn- Name of the application to be stopped
- smClient- i18n support for current client's locale
 
- 
undeployUndeploy the web application at the specified context path.- Parameters:
- writer- Writer to render to
- cn- Name of the application to be removed
- smClient- i18n support for current client's locale
 
- 
isDeployedInvoke the isDeployed method on the deployer.- Parameters:
- name- The webapp name
- Returns:
- trueif a webapp with that name is deployed
- Throws:
- Exception- Propagate JMX invocation error
 
- 
checkInvoke the check method on the deployer.- Parameters:
- name- The webapp name
- Throws:
- Exception- Propagate JMX invocation error
 
- 
isServicedDeprecated.Unused. Will be removed in Tomcat 10.1.x onwards.Invoke the isServiced method on the deployer.- Parameters:
- name- The webapp name
- Returns:
- trueif a webapp with that name is being serviced
- Throws:
- Exception- Propagate JMX invocation error
 
- 
addServicedDeprecated.Unused. Will be removed in Tomcat 10.1.x onwards. UsetryAddServiced(java.lang.String)Invoke the addServiced method on the deployer.- Parameters:
- name- The webapp name
- Throws:
- Exception- Propagate JMX invocation error
 
- 
tryAddServicedAttempt to mark a context as being serviced- Parameters:
- name- The context name
- Returns:
- trueif the application was marked as being serviced and- falseif the application was already marked as being serviced
- Throws:
- Exception- Error invoking the deployer
 
- 
removeServicedInvoke the removeServiced method on the deployer.- Parameters:
- name- The webapp name
- Throws:
- Exception- Propagate JMX invocation error
 
- 
uploadWarprotected void uploadWar(PrintWriter writer, HttpServletRequest request, File war, StringManager smClient) throws IOException Upload the WAR file included in this request, and store it at the specified file location.- Parameters:
- writer- Writer to render to
- request- The servlet request we are processing
- war- The file into which we should store the uploaded WAR
- smClient- The StringManager used to construct i18n messages based on the Locale of the client
- Throws:
- IOException- if an I/O error occurs during processing
 
- 
validateContextNameprotected static boolean validateContextName(ContextName cn, PrintWriter writer, StringManager smClient) 
- 
getConnectorCiphers
- 
getConnectorCerts
- 
getConnectorTrustedCerts
 
-