2004-09-29 jrandom

* Always wipe the Jetty work directory on startup, so that web updates
      are reflected immediately (Jetty does not honor the cache across
      multiple executions)
in addition, refactor various file ops out of the DataHelper into FileUtil
This commit is contained in:
jrandom authored and zzz committed 2004-09-29 19:34:02 +00:00
1 parent 774231f347
commit 010b285e67
7 files changed
+196 -100

No files matched your search

@@ -4,8 +4,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import net.i2p.data.DataHelper;
import net.i2p.router.RouterContext;
import net.i2p.util.FileUtil;
public class ContentHelper {
private String _page;
@@ -40,14 +40,14 @@ public class ContentHelper {
}
}
public String getContent() {
String str = DataHelper.readTextFile(_page, _maxLines);
String str = FileUtil.readTextFile(_page, _maxLines);
if (str == null)
return "";
else
return str;
}
public String getTextContent() {
String str = DataHelper.readTextFile(_page, _maxLines);
String str = FileUtil.readTextFile(_page, _maxLines);
if (str == null)
return "";
else
@@ -4,8 +4,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import net.i2p.data.DataHelper;
import net.i2p.router.RouterContext;
import net.i2p.util.FileUtil;
public class LogsHelper {
private RouterContext _context;
@@ -42,7 +42,7 @@ public class LogsHelper {
}
public String getServiceLogs() {
String str = DataHelper.readTextFile("wrapper.log", 500);
String str = FileUtil.readTextFile("wrapper.log", 500);
if (str == null)
return "";
else
@@ -1,10 +1,12 @@
package net.i2p.router.web;
import java.io.File;
import java.io.IOException;
import java.util.List;
import net.i2p.router.RouterContext;
import net.i2p.apps.systray.SysTray;
import net.i2p.util.FileUtil;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.WebApplicationContext;
@@ -35,6 +37,14 @@ public class RouterConsoleRunner {
}
public void startConsole() {
File workDir = new File("work");
boolean workDirRemoved = FileUtil.rmdir(workDir, false);
if (!workDirRemoved)
System.err.println("ERROR: Unable to remove Jetty temporary work directory");
boolean workDirCreated = workDir.mkdirs();
if (!workDirCreated)
System.err.println("ERROR: Unable to create Jetty temporary work directory");
_server = new Server();
WebApplicationContext contexts[] = null;
try {