From bd0c18b2e31f3c0a7e6fa46d3a38e530043921ce Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Sat, 21 Sep 2013 16:11:55 +0000 Subject: [PATCH] * Console: Implement webapp state detection and stop button for webapps on /configclients (Ticket #1025) --- .../i2p/router/web/ConfigClientsHandler.java | 18 ++++++++++++------ .../i2p/router/web/ConfigClientsHelper.java | 3 ++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java index 29cb400984..27774b0ca4 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java @@ -123,12 +123,18 @@ public class ConfigClientsHandler extends FormHandler { if (appnum >= 0) { stopClient(appnum); } else { - try { - PluginStarter.stopPlugin(_context, app); - addFormNotice(_("Stopped plugin {0}", app)); - } catch (Throwable e) { - addFormError(_("Error stopping plugin {0}", app) + ": " + e); - _log.error("Error stopping plugin " + app, e); + List<String> plugins = PluginStarter.getPlugins(); + if (plugins.contains(app)) { + try { + PluginStarter.stopPlugin(_context, app); + addFormNotice(_("Stopped plugin {0}", app)); + } catch (Throwable e) { + addFormError(_("Error stopping plugin {0}", app) + ": " + e); + _log.error("Error stopping plugin " + app, e); + } + } else { + WebAppStarter.stopWebApp(app); + addFormNotice(_("Stopped webapp {0}", app)); } } return; diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java index c0c4d0aa4e..28febc9f27 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java @@ -145,9 +145,10 @@ public class ConfigClientsHelper extends HelperBase { if (name.startsWith(RouterConsoleRunner.PREFIX) && name.endsWith(RouterConsoleRunner.ENABLED)) { String app = name.substring(RouterConsoleRunner.PREFIX.length(), name.lastIndexOf(RouterConsoleRunner.ENABLED)); String val = props.getProperty(name); + boolean isRunning = WebAppStarter.isWebAppRunning(app); renderForm(buf, app, app, !"addressbook".equals(app), "true".equals(val), RouterConsoleRunner.ROUTERCONSOLE.equals(app), app + ".war", - false, false, false, false, false, true); + false, false, false, isRunning, false, !isRunning); } } buf.append("</table>\n"); -- GitLab