\n" + + " \n" + + " \n" + " \n" + - "   {10}  {12} \n" + + "   {12}  {14} \n" + " \n" + "
\n" + " \n" + @@ -1133,7 +1160,7 @@ "\n"; private static final String STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION = - " \n" + + " \n" + "  {1} \n" + "
" + " " + @@ -1144,12 +1171,15 @@ " " + " " + "
\n" + + "
" + + " " + + "
\n" + " \n" + " \n" + - " \n" + - "
\n" + + " \n" + + " \n" + " \n" + - "   {10}  {12} \n" + + "   {12}  {14} \n" + " \n" + "
\n" + " \n" + @@ -1156,14 +1186,15 @@ "\n"; private static final String STOPPED_DEPLOYED_APPS_ROW_BUTTON_SECTION = - " \n" + + " \n" + "
" + " " + "
\n" + "  {3} \n" + "  {5} \n" + - "
" + - " " + + "  {7} \n" + + " " + + " " + "
\n" + " \n" + "\n\n"; @@ -1177,13 +1208,16 @@ "
" + " " + "
\n" + - "  {7} \n" + + "
" + + " " + + "
\n" + + "  {9} \n" + " \n" + " \n" + - " \n" + - "
\n" + + " \n" + + " \n" + " \n" + - "   {10}  {12} \n" + + "   {12}  {14} \n" + " \n" + "
\n" + " \n" + @@ -1190,7 +1224,7 @@ "\n"; private static final String STOPPED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION = - " \n" + + " \n" + "
" + " " + "
\n" + @@ -1197,6 +1231,7 @@ "  {3} \n" + "  {5} \n" + "  {7} \n" + + "  {9} \n" + " \n" + "\n\n"; --- java/org/apache/catalina/manager/LocalStrings.properties (revision 1754315) +++ java/org/apache/catalina/manager/LocalStrings.properties (working copy) @@ -17,6 +17,7 @@ htmlManagerServlet.appsName=Display Name htmlManagerServlet.appsPath=Path htmlManagerServlet.appsReload=Reload +htmlManagerServlet.appsRedeploy=Redeploy htmlManagerServlet.appsUndeploy=Undeploy htmlManagerServlet.appsVersion=Version htmlManagerServlet.appsExpire=Expire sessions @@ -97,6 +98,7 @@ managerServlet.objectNameFail=FAIL - Unable to register object name [{0}] for Manager Servlet managerServlet.postCommand=FAIL - Tried to use command {0} via a GET request but POST is required managerServlet.reloaded=OK - Reloaded application at context path {0} +managerServlet.redeployed=OK - Redeployed application at context path {0} managerServlet.resourcesAll=OK - Listed global resources of all types managerServlet.resourcesType=OK - Listed global resources of type {0} managerServlet.saveFail=FAIL - Configuration save failed: {0} --- java/org/apache/catalina/manager/ManagerServlet.java (revision 1754315) +++ java/org/apache/catalina/manager/ManagerServlet.java (working copy) @@ -359,6 +359,8 @@ stop(writer, cn, smClient); } else if (command.equals("/undeploy")) { undeploy(writer, cn, smClient); + } else if (command.equals("/redeploy")) { + redeploy(writer, cn, smClient); } else if (command.equals("/findleaks")) { findleaks(statusLine, writer, smClient); } else if (command.equals("/vminfo")) { @@ -1006,7 +1008,6 @@ } - /** * Render a list of available global JNDI resources. * @@ -1425,6 +1426,67 @@ } + /** + * Redeploy the web application at the specified context path. + * + * @param writer Writer to render to + * @param cn Name of the application to be redeployed + */ + protected void redeploy(PrintWriter writer, ContextName cn, + StringManager smClient) { + + if (debug >= 1) + log("redeploy: Redeploying web application '" + cn + "'"); + + if (!validateContextName(cn, writer, smClient)) { + return; + } + + String name = cn.getName(); + String displayPath = cn.getDisplayName(); + + try { + + // Validate the Context of the specified application + Context context = (Context) host.findChild(name); + if (context == null) { + writer.println(smClient.getString("managerServlet.noContext", + RequestUtil.filter(displayPath))); + return; + } + + if (!isDeployed(name)) { + writer.println(smClient.getString("managerServlet.notDeployed", + RequestUtil.filter(displayPath))); + return; + } + + if (isServiced(name)) { + writer.println(smClient.getString("managerServlet.inService", displayPath)); + } else { + addServiced(name); + try { + // Undeploy without touching files + undeployInPlace(name); + // Perform redeployment + check(name); + } finally { + removeServiced(name); + } + } + + writer.println(smClient.getString("managerServlet.redeployed", + cn.getDisplayName())); + } catch (Throwable t) { + ExceptionUtils.handleThrowable(t); + log("ManagerServlet.redeploy[" + cn.getDisplayName() + "]", t); + writer.println(smClient.getString("managerServlet.exception", + t.toString())); + } + + } + + // -------------------------------------------------------- Support Methods @@ -1453,6 +1515,17 @@ /** + * Invoke the undeploy method on the deployer. + */ + protected void undeployInPlace(String name) + throws Exception { + String[] params = { name }; + String[] signature = { "java.lang.String" }; + mBeanServer.invoke(oname, "undeploy", params, signature); + } + + + /** * Invoke the isServiced method on the deployer. */ protected boolean isServiced(String name) --- java/org/apache/catalina/startup/HostConfig.java (revision 1754315) +++ java/org/apache/catalina/startup/HostConfig.java (working copy) @@ -1667,6 +1667,20 @@ } /** + * Undeploy a specific web application. If autoDeploy is enabled, this + * method does nothing to prevent the web application from being + * automatically deployed again. + * + * @param name The name of the web application to undeploy + */ + public void undeploy(String name){ + DeployedApplication app = deployed.get(name); + if(app != null){ + undeploy(app); + } + } + + /** * Add a new Context to be managed by us. * Entry point for the admin webapp, and other JMX Context controllers. */ --- java/org/apache/catalina/startup/mbeans-descriptors.xml (revision 1754315) +++ java/org/apache/catalina/startup/mbeans-descriptors.xml (working copy) @@ -111,6 +111,15 @@ returnType="void"> + + + + + + + +