- Add DTG to updater
  - Fix and bundle DTG license info
  - Remove jstl.jar and standard.jar from updater,
    last changed in 0.9
  - Fix bundling of Tomcat license info
Console:
  - Change to new DTG constructor
  - Don't attempt to start systray or DTG when running as a service
This commit is contained in:
zzz
2016-05-06 15:56:54 +00:00
parent ecafcddddb
commit 70f9cb1b19
3 changed files with 28 additions and 17 deletions

View File

@ -39,6 +39,7 @@ import net.i2p.util.PortMapper;
import net.i2p.util.SecureDirectory;
import net.i2p.util.I2PSSLSocketFactory;
import net.i2p.util.SystemVersion;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.ConstraintMapping;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
@ -69,6 +70,8 @@ import org.eclipse.jetty.util.thread.ExecutorThreadPool;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.ThreadPool;
import org.tanukisoftware.wrapper.WrapperManager;
/**
* Start the router console.
*/
@ -128,6 +131,7 @@ public class RouterConsoleRunner implements RouterApp {
private static final int MAX_THREADS = 24;
private static final int MAX_IDLE_TIME = 90*1000;
private static final String THREAD_NAME = "RouterConsole Jetty";
private final static String DAEMON_USER = "i2psvc";
/**
* <pre>
@ -213,7 +217,7 @@ public class RouterConsoleRunner implements RouterApp {
public synchronized void startup() {
changeState(STARTING);
checkJavaVersion();
startTrayApp(_context);
startTrayApp();
startConsole();
}
@ -265,18 +269,23 @@ public class RouterConsoleRunner implements RouterApp {
return _server;
}
private static void startTrayApp(I2PAppContext ctx) {
private void startTrayApp() {
// if no permissions, don't even try
// isLaunchedAsService() always returns true on Linux
if (DAEMON_USER.equals(System.getProperty("user.name")) ||
(SystemVersion.isWindows() && _context.hasWrapper() && WrapperManager.isLaunchedAsService())) {
// required true for jrobin to work
System.setProperty("java.awt.headless", "true");
return;
}
try {
//TODO: move away from routerconsole into a separate application.
//ApplicationManager?
boolean recentJava = SystemVersion.isJava6();
// default false for now
boolean desktopguiEnabled = ctx.getBooleanProperty("desktopgui.enabled");
if (recentJava && desktopguiEnabled) {
boolean desktopguiEnabled = _context.getBooleanProperty("desktopgui.enabled");
if (desktopguiEnabled) {
//Check if we are in a headless environment, set properties accordingly
System.setProperty("java.awt.headless", Boolean.toString(GraphicsEnvironment.isHeadless()));
String[] args = new String[0];
net.i2p.desktopgui.Main.beginStartup(args);
net.i2p.desktopgui.Main dtg = new net.i2p.desktopgui.Main(_context, _mgr, null);
dtg.startup();
} else {
// required true for jrobin to work
System.setProperty("java.awt.headless", "true");