Author: dbkr
Date: 2006-03-18 00:04:47 +0000 (Sat, 18 Mar 2006)
New Revision: 8271
Modified:
trunk/freenet/src/freenet/clients/http/FproxyToadlet.java
trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
trunk/freenet/src/freenet/clients/http/Toadlet.java
trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
trunk/freenet/src/freenet/node/fcp/FCPServer.java
trunk/freenet/src/freenet/pluginmanager/PproxyToadlet.java
Log:
- Remove the last of the Meta Refresh pages, and therefore remove
'mkForwardPage() from Toadlet
- Change all instances of 'bindto' to 'bindTo' to match the CamelCase syntax
throughout the rest of the config file.
Modified: trunk/freenet/src/freenet/clients/http/FproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FproxyToadlet.java 2006-03-17
23:05:27 UTC (rev 8270)
+++ trunk/freenet/src/freenet/clients/http/FproxyToadlet.java 2006-03-18
00:04:47 UTC (rev 8271)
@@ -141,7 +141,7 @@
server.register(darknetToadlet, "/darknet/", true);
} catch (IOException ioe) {
- Logger.error(node,"Failed to start fproxy on
"+fproxyConfig.getString("bindto")+":"+fproxyConfig.getInt("port"));
+ Logger.error(node,"Failed to start fproxy on
"+fproxyConfig.getString("bindTo")+":"+fproxyConfig.getInt("port"));
}
fproxyConfig.finishedInitialization();
Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2006-03-17 23:05:27 UTC (rev 8270)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2006-03-18 00:04:47 UTC (rev 8271)
@@ -37,7 +37,7 @@
}
final int port;
- final String bindto;
+ final String bindTo;
final BucketFactory bf;
private final ServerSocket sock;
private final LinkedList toadlets;
@@ -62,11 +62,11 @@
class FproxyBindtoCallback implements StringCallback {
public String get() {
- return bindto;
+ return bindTo;
}
- public void set(String bindto) throws
InvalidConfigValueException {
- if(bindto != get())
+ public void set(String bindTo) throws
InvalidConfigValueException {
+ if(bindTo != get())
throw new InvalidConfigValueException("Cannot
change fproxy bind address on the fly");
}
}
@@ -120,19 +120,19 @@
fproxyConfig.register("port", DEFAULT_FPROXY_PORT, 2, true,
"Fproxy port number", "Fproxy port number",
new FproxyPortCallback());
- fproxyConfig.register("bindto", "127.0.0.1", 2, true, "IP
address to bind to", "IP address to bind to",
+ fproxyConfig.register("bindTo", "127.0.0.1", 2, true, "IP
address to bind to", "IP address to bind to",
new FproxyBindtoCallback());
fproxyConfig.register("css", "clean", 1, true, "CSS Name",
"Name of the CSS Fproxy should use",
new FproxyCSSNameCallback());
this.bf = node.tempBucketFactory;
port = fproxyConfig.getInt("port");
- bindto = fproxyConfig.getString("bindto");
+ bindTo = fproxyConfig.getString("bindTo");
cssName = fproxyConfig.getString("css");
if(cssName.indexOf(':') != -1 || cssName.indexOf('/') != -1)
throw new InvalidConfigValueException("CSS name must
not contain slashes or colons!");
- this.sock = new ServerSocket(port, 0,
InetAddress.getByName(this.bindto));
+ this.sock = new ServerSocket(port, 0,
InetAddress.getByName(this.bindTo));
toadlets = new LinkedList();
node.setToadletContainer(this); // even if not enabled, because
of config
@@ -144,15 +144,15 @@
myThread.setDaemon(true);
myThread.start();
System.out.println("Starting fproxy on port "+(port));
- Logger.normal(this, "Starting fproxy on
"+bindto+":"+port);
+ Logger.normal(this, "Starting fproxy on
"+bindTo+":"+port);
}
}
- public SimpleToadletServer(int i, String newbindto, BucketFactory bf,
String cssName) throws IOException {
+ public SimpleToadletServer(int i, String newbindTo, BucketFactory bf,
String cssName) throws IOException {
this.port = i;
- this.bindto = newbindto;
+ this.bindTo = newbindTo;
this.bf = bf;
- this.sock = new ServerSocket(port, 0,
InetAddress.getByName(this.bindto));
+ this.sock = new ServerSocket(port, 0,
InetAddress.getByName(this.bindTo));
toadlets = new LinkedList();
this.cssName = cssName;
Thread t = new Thread(this, "SimpleToadletServer");
Modified: trunk/freenet/src/freenet/clients/http/Toadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Toadlet.java 2006-03-17 23:05:27 UTC
(rev 8270)
+++ trunk/freenet/src/freenet/clients/http/Toadlet.java 2006-03-18 00:04:47 UTC
(rev 8271)
@@ -157,14 +157,4 @@
protected HighLevelSimpleClient getClientImpl() {
return client;
}
-
- public String mkForwardPage(ToadletContext ctx, String title, String
content, String nextpage, int interval) {
- if (content == null) content = "null";
-
- return "<HTML><HEAD><link rel=\"stylesheet\"
href=\"/static/themes/"+ctx.getPageMaker().theme+"/theme.css\"
type=\"text/css\" /><head><title>" + title + "</title>"+
- "<META HTTP-EQUIV=Refresh CONTENT=\"" + interval +
- "; URL="+nextpage+"\"></head><body><h1>" + title +
- "</h1>" + content.replaceAll("\n", "<br/>\n") + "</body>";
- }
-
}
Modified: trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
2006-03-17 23:05:27 UTC (rev 8270)
+++ trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
2006-03-18 00:04:47 UTC (rev 8271)
@@ -30,10 +30,10 @@
final Hashtable streams;
final File downloadsDir;
int port;
- final String bindto;
+ final String bindTo;
boolean isEnabled;
- TextModeClientInterfaceServer(Node n, HighLevelSimpleClient client, int
port, String bindto) {
+ TextModeClientInterfaceServer(Node n, HighLevelSimpleClient client, int
port, String bindTo) {
this.n = n;
this.client = client;
client.addGlobalHook(new EventDumper());
@@ -41,7 +41,7 @@
streams = new Hashtable();
this.downloadsDir = n.downloadDir;
this.port=port;
- this.bindto=bindto;
+ this.bindTo=bindTo;
this.isEnabled=true;
n.setTMCI(this);
new Thread(this, "Text mode client interface").start();
@@ -52,7 +52,7 @@
TMCIConfig.register("enabled", true, 1, true, "Enable TMCI",
"Whether to enable the TMCI",
new TMCIEnabledCallback(node));
- TMCIConfig.register("bindto", "127.0.0.1", 2, true, "IP address
to bind to", "IP address to bind to",
+ TMCIConfig.register("bindTo", "127.0.0.1", 2, true, "IP address
to bind to", "IP address to bind to",
new TMCIBindtoCallback(node));
TMCIConfig.register("port", 2323, 1, true, "Testnet port",
"Testnet port number",
new TCMIPortNumberCallback(node));
@@ -61,7 +61,7 @@
boolean TMCIEnabled = TMCIConfig.getBoolean("enabled");
int port = TMCIConfig.getInt("port");
- String bind_ip = TMCIConfig.getString("bindto");
+ String bind_ip = TMCIConfig.getString("bindTo");
boolean direct = TMCIConfig.getBoolean("directEnabled");
HighLevelSimpleClient client =
node.makeClient(RequestStarter.INTERACTIVE_PRIORITY_CLASS);
@@ -135,7 +135,7 @@
public String get() {
if(node.getTextModeClientInterface()!=null)
- return node.getTextModeClientInterface().bindto;
+ return node.getTextModeClientInterface().bindTo;
else
return "127.0.0.1";
}
@@ -174,12 +174,12 @@
public void run() {
while(true) {
int curPort = port;
- String bindTo = this.bindto;
+ String bindTo = this.bindTo;
ServerSocket server;
try {
server = new ServerSocket(curPort, 0,
InetAddress.getByName(bindTo));
} catch (IOException e) {
- Logger.error(this, "Could not bind to TMCI port:
"+bindto+":"+port);
+ Logger.error(this, "Could not bind to TMCI port:
"+bindTo+":"+port);
System.exit(-1);
return;
}
@@ -194,7 +194,7 @@
while(isEnabled) {
// Maybe something has changed?
if(port != curPort) break;
- if(!(this.bindto.equals(bindTo))) break;
+ if(!(this.bindTo.equals(bindTo))) break;
try {
Socket s = server.accept();
InputStream in = s.getInputStream();
Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java 2006-03-17 23:05:27 UTC
(rev 8270)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java 2006-03-18 00:04:47 UTC
(rev 8271)
@@ -40,7 +40,7 @@
final Node node;
final int port;
final boolean enabled;
- final String bindto;
+ final String bindTo;
final WeakHashMap clientsByName;
final FCPClient globalClient;
private boolean enablePersistentDownloads;
@@ -68,11 +68,11 @@
}
public FCPServer(String ipToBindTo, int port, Node node, boolean
persistentDownloadsEnabled, String persistentDownloadsDir, long
persistenceInterval) throws IOException, InvalidConfigValueException {
- this.bindto = new String(ipToBindTo);
+ this.bindTo = new String(ipToBindTo);
this.persistenceInterval = persistenceInterval;
this.port = port;
this.enabled = true;
- this.sock = new ServerSocket(port, 0,
InetAddress.getByName(bindto));
+ this.sock = new ServerSocket(port, 0,
InetAddress.getByName(bindTo));
this.node = node;
clientsByName = new WeakHashMap();
// This one is only used to get the default settings.
Individual FCP conns
@@ -160,7 +160,7 @@
}
public String get() {
- return node.getFCPServer().bindto;
+ return node.getFCPServer().bindTo;
}
//TODO: Allow it
@@ -225,7 +225,7 @@
fcpConfig.register("enabled", true, 2, true, "Is FCP server
enabled ?", "Is FCP server enabled ?", new FCPEnabledCallback(node));
fcpConfig.register("port", 9481 /* anagram of 1984, and 1000 up
from old number */,
2, true, "FCP port number", "FCP port number",
new FCPPortNumberCallback(node));
- fcpConfig.register("bindto", "127.0.0.1", 2, true, "Ip address
to bind to", "Ip address to bind the FCP server to", new
FCPBindtoCallback(node));
+ fcpConfig.register("bindTo", "127.0.0.1", 2, true, "Ip address
to bind to", "Ip address to bind the FCP server to", new
FCPBindtoCallback(node));
PersistentDownloadsEnabledCallback cb1;
PersistentDownloadsFileCallback cb2;
PersistentDownloadsIntervalCallback cb3;
@@ -244,8 +244,8 @@
FCPServer fcp;
if(fcpConfig.getBoolean("enabled")){
- Logger.normal(node, "Starting FCP server on
"+fcpConfig.getString("bindto")+":"+fcpConfig.getInt("port")+".");
- fcp = new FCPServer(fcpConfig.getString("bindto"),
fcpConfig.getInt("port"), node, persistentDownloadsEnabled,
persistentDownloadsDir, persistentDownloadsInterval);
+ Logger.normal(node, "Starting FCP server on
"+fcpConfig.getString("bindTo")+":"+fcpConfig.getInt("port")+".");
+ fcp = new FCPServer(fcpConfig.getString("bindTo"),
fcpConfig.getInt("port"), node, persistentDownloadsEnabled,
persistentDownloadsDir, persistentDownloadsInterval);
node.setFCPServer(fcp);
if(fcp != null) {
Modified: trunk/freenet/src/freenet/pluginmanager/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PproxyToadlet.java 2006-03-17
23:05:27 UTC (rev 8270)
+++ trunk/freenet/src/freenet/pluginmanager/PproxyToadlet.java 2006-03-18
00:04:47 UTC (rev 8271)
@@ -184,7 +184,8 @@
}
if (fn == null) {
- writeReply(ctx, 200, "text/html", "OK",
mkForwardPage(ctx,"Error", "Plugin not found...", ".", 5));
+ this.sendErrorPage(ctx, 404, "Plugin not
found", "The specified plugin could not be located in order to reload it.");
+ //writeReply(ctx, 200, "text/html", "OK",
mkForwardPage(ctx,"Error", "Plugin not found...", ".", 5));
} else {
pm.killPlugin(request.getParam("reload"));
pm.startPlugin(fn);