move getConsoleServer() method

This commit is contained in:
zzz
2010-02-18 16:33:47 +00:00
parent 3d8365a473
commit 82444f9e7b
5 changed files with 35 additions and 22 deletions

View File

@ -254,7 +254,7 @@ public class ConfigClientsHandler extends FormHandler {
* requested and add the .war to that one * requested and add the .war to that one
*/ */
private void startWebApp(String app) { private void startWebApp(String app) {
Server s = PluginStarter.getConsoleServer(); Server s = WebAppStarter.getConsoleServer();
if (s != null) { if (s != null) {
try { try {
File path = new File(_context.getBaseDir(), "webapps"); File path = new File(_context.getBaseDir(), "webapps");

View File

@ -6,7 +6,6 @@ import java.lang.reflect.Method;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -23,7 +22,6 @@ import net.i2p.util.FileUtil;
import net.i2p.util.Log; import net.i2p.util.Log;
import net.i2p.util.Translate; import net.i2p.util.Translate;
import org.mortbay.http.HttpListener;
import org.mortbay.jetty.Server; import org.mortbay.jetty.Server;
@ -93,7 +91,7 @@ public class PluginStarter implements Runnable {
} }
// start console webapps in console/webapps // start console webapps in console/webapps
Server server = getConsoleServer(); Server server = WebAppStarter.getConsoleServer();
if (server != null) { if (server != null) {
File consoleDir = new File(pluginDir, "console"); File consoleDir = new File(pluginDir, "console");
Properties props = RouterConsoleRunner.webAppProperties(consoleDir.getAbsolutePath()); Properties props = RouterConsoleRunner.webAppProperties(consoleDir.getAbsolutePath());
@ -185,7 +183,7 @@ public class PluginStarter implements Runnable {
} }
// stop console webapps in console/webapps // stop console webapps in console/webapps
Server server = getConsoleServer(); Server server = WebAppStarter.getConsoleServer();
if (server != null) { if (server != null) {
File consoleDir = new File(pluginDir, "console"); File consoleDir = new File(pluginDir, "console");
Properties props = RouterConsoleRunner.webAppProperties(consoleDir.getAbsolutePath()); Properties props = RouterConsoleRunner.webAppProperties(consoleDir.getAbsolutePath());
@ -318,20 +316,6 @@ public class PluginStarter implements Runnable {
} catch (IOException ioe) {} } catch (IOException ioe) {}
} }
/** see comments in ConfigClientsHandler */
static Server getConsoleServer() {
Collection c = Server.getHttpServers();
for (int i = 0; i < c.size(); i++) {
Server s = (Server) c.toArray()[i];
HttpListener[] hl = s.getListeners();
for (int j = 0; j < hl.length; j++) {
if (hl[j].getPort() == 7657)
return s;
}
}
return null;
}
/** @param action "start" or "stop" or "uninstall" */ /** @param action "start" or "stop" or "uninstall" */
private static void runClientApps(RouterContext ctx, File pluginDir, List<ClientAppConfig> apps, String action) { private static void runClientApps(RouterContext ctx, File pluginDir, List<ClientAppConfig> apps, String action) {
Log log = ctx.logManager().getLog(PluginStarter.class); Log log = ctx.logManager().getLog(PluginStarter.class);

View File

@ -2,12 +2,14 @@ package net.i2p.router.web;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Collection;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import net.i2p.I2PAppContext; import net.i2p.I2PAppContext;
import org.mortbay.http.HttpContext; import org.mortbay.http.HttpContext;
import org.mortbay.http.HttpListener;
import org.mortbay.jetty.Server; import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.WebApplicationContext; import org.mortbay.jetty.servlet.WebApplicationContext;
@ -73,4 +75,17 @@ public class WebAppStarter {
} catch (InterruptedException ie) {} } catch (InterruptedException ie) {}
} }
/** see comments in ConfigClientsHandler */
static Server getConsoleServer() {
Collection c = Server.getHttpServers();
for (int i = 0; i < c.size(); i++) {
Server s = (Server) c.toArray()[i];
HttpListener[] hl = s.getListeners();
for (int j = 0; j < hl.length; j++) {
if (hl[j].getPort() == 7657)
return s;
}
}
return null;
}
} }

View File

@ -1,3 +1,16 @@
2010-02-18 zzz
* Clock: Slew tweak
* i2psnark: Improve error message when finding HTML
* HTTP Proxy: Fix blank page instead of error page for eepsite unreachable
* Plugins:
- Fix plugin start button
- Change signer prop to match docs
- Tweaks
* Transport:
- Fix recognition of IP change when not firewalled
- Require consecutive identical results from two peers before changing IP
* TrustedUpdate: CLI exits 1 on failure for ease of use in scripts
2010-02-15 zzz 2010-02-15 zzz
Propagate from 3 dev branches. Propagate from 3 dev branches.
@ -17,7 +30,8 @@
* Streaming: MessageOutputStream logging tweaks * Streaming: MessageOutputStream logging tweaks
* Transport: * Transport:
- Prepare for using address costs - Prepare for using address costs
- Adjust bids based on address cost, disabled until 0.7.12 - Adjust bids based on address cost
- Increase cost if near transport capacity, disabled until 0.7.12
- Clear the geoip negative cache periodically - Clear the geoip negative cache periodically
i2p.i2p.zzz.plugin: i2p.i2p.zzz.plugin:
@ -61,7 +75,7 @@
- Save expired tunnel build configs for a while, so that we will still use the tunnel - Save expired tunnel build configs for a while, so that we will still use the tunnel
and update peer stats if the reply comes in late and update peer stats if the reply comes in late
- Don't update our own profile for Tunnel Build Replies - Don't update our own profile for Tunnel Build Replies
- VTBM generation only through routers >= 0.1.12 - VTBM generation only through routers >= 0.7.12
- VTBM generation disabled for now - VTBM generation disabled for now
* 2010-02-15 0.7.11 released * 2010-02-15 0.7.11 released

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 1; public final static long BUILD = 2;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";