[freenet-cvs] r12581 - trunk/freenet/src/freenet/clients/http

toad at freenetproject.org toad at freenetproject.org
Wed Apr 11 17:04:47 UTC 2007


Author: toad
Date: 2007-04-11 17:04:47 +0000 (Wed, 11 Apr 2007)
New Revision: 12581

Modified:
   trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
Log:
myref.fref is application/x-freenet-reference (so will be saved to disk as .fref rather than .txt; ideal for email, file exchange over IM etc)

Modified: trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java	2007-04-11 16:45:18 UTC (rev 12580)
+++ trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java	2007-04-11 17:04:47 UTC (rev 12581)
@@ -65,6 +65,17 @@
 			SimpleFieldSet fs = node.exportPublicFieldSet();
 			StringWriter sw = new StringWriter();
 			fs.writeTo(sw);
+			MultiValueTable extraHeaders = new MultiValueTable();
+			// Force download to disk
+			extraHeaders.put("Content-Disposition", "attachment; filename=myref.fref");
+			this.writeReply(ctx, 200, "application/x-freenet-reference", "OK", extraHeaders, sw.toString());
+			return;
+		}
+
+		if(path.endsWith("myref.txt")) {
+			SimpleFieldSet fs = node.exportPublicFieldSet();
+			StringWriter sw = new StringWriter();
+			fs.writeTo(sw);
 			this.writeReply(ctx, 200, "text/plain", "OK", sw.toString());
 			return;
 		}
@@ -588,6 +599,9 @@
 		HTMLNode referenceInfobox = contentNode.addChild("div", "class", "infobox infobox-normal");
 		HTMLNode headerReferenceInfobox = referenceInfobox.addChild("div", "class", "infobox-header");
 		headerReferenceInfobox.addChild("a", "href", "myref.fref", "My reference");
+		headerReferenceInfobox.addChild("#", " (");
+		headerReferenceInfobox.addChild("a", "href", "myref.txt", "as text");
+		headerReferenceInfobox.addChild("#", ")");
 		HTMLNode warningSentence = headerReferenceInfobox.addChild("pre");
 		warningSentence.addChild("#", "Node reference must be copied ");
 		warningSentence.addChild("big").addChild("b", "AS IS. ");




More information about the cvs mailing list