[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] storm ./Makefile org/nongnu/storm/http/server/H...
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] storm ./Makefile org/nongnu/storm/http/server/H... |
Date: |
Mon, 23 Jun 2003 17:18:32 -0400 |
CVSROOT: /cvsroot/storm
Module name: storm
Branch:
Changes by: Benja Fallenstein <address@hidden> 03/06/23 17:18:31
Modified files:
. : Makefile
org/nongnu/storm/http/server: HTTPServer.java
org/nongnu/storm/util: HTTPProxy.java
Log message:
way to create new pointer and get just URI, not HTML page -> for use
from shell scripts
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/Makefile.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/http/server/HTTPServer.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/util/HTTPProxy.java.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
Patches:
Index: storm/Makefile
diff -u storm/Makefile:1.22 storm/Makefile:1.23
--- storm/Makefile:1.22 Fri Jun 13 08:00:53 2003
+++ storm/Makefile Mon Jun 23 17:18:31 2003
@@ -22,7 +22,8 @@
exec $(JAVA) $(DEBUG) org.nongnu.storm.modules.gispmap.GispP2PMap
$(SEEDS)
http-gateway:
- exec $(JAVA) $(DEBUG) org.nongnu.storm.util.HTTPProxy $(POOL) $(KEYFILE)
+ #exec $(JAVA) $(DEBUG) org.nongnu.storm.util.HTTPProxy $(POOL)
$(KEYFILE)
+ $(JAVA) $(DEBUG) org.nongnu.storm.util.HTTPProxy $(POOL) $(KEYFILE)
peer:
exec $(JAVA) $(DEBUG) org.nongnu.storm.modules.gispmap.GispPeer $(ARGS)
Index: storm/org/nongnu/storm/http/server/HTTPServer.java
diff -u storm/org/nongnu/storm/http/server/HTTPServer.java:1.5
storm/org/nongnu/storm/http/server/HTTPServer.java:1.6
--- storm/org/nongnu/storm/http/server/HTTPServer.java:1.5 Mon May 5
10:35:01 2003
+++ storm/org/nongnu/storm/http/server/HTTPServer.java Mon Jun 23 17:18:31 2003
@@ -46,8 +46,11 @@
*/
public HTTPServer(HTTPConnection.Factory connf, int port)
throws IOException {
+ System.out.println("X");
this.connf = connf;
+ System.out.println("X, "+port);
lsock = new ServerSocket(port);
+ System.out.println("X");
}
/** Instantiate this HTTP server.
@@ -59,8 +62,11 @@
*/
public HTTPServer(HTTPConnection.Factory connf, int port, int backlog)
throws IOException {
+ System.out.println("Y");
this.connf = connf;
+ System.out.println("Y");
lsock = new ServerSocket(port, backlog);
+ System.out.println("Y");
}
/** Instantiate this HTTP server.
@@ -73,8 +79,11 @@
*/
public HTTPServer(HTTPConnection.Factory connf, int port, int backlog,
InetAddress bindAddr) throws IOException {
+ System.out.println("Z");
this.connf = connf;
+ System.out.println("Z");
lsock = new ServerSocket(port, backlog, bindAddr);
+ System.out.println("Z");
}
Index: storm/org/nongnu/storm/util/HTTPProxy.java
diff -u storm/org/nongnu/storm/util/HTTPProxy.java:1.46
storm/org/nongnu/storm/util/HTTPProxy.java:1.47
--- storm/org/nongnu/storm/util/HTTPProxy.java:1.46 Mon May 26 22:56:21 2003
+++ storm/org/nongnu/storm/util/HTTPProxy.java Mon Jun 23 17:18:31 2003
@@ -60,13 +60,17 @@
public HTTPProxy(IndexedPool pool, int port) throws IOException {
this.pool = pool;
this.port = port;
+ System.out.println("BAR");
this.addr = InetAddress.getLocalHost().getHostName();
+ System.out.println("BAR");
this.ROOTURL = "http://"+addr+":"+port+"/";
this.REWRITE = "rewrite";
this.BACKLINKS = "backlinks";
this.URNPAC = "urn-proxy.pac";
+ System.out.println("BAR");
this.server = new HTTPServer(new Factory(), port);
+ System.out.println("BAR");
}
/** Construct a gateway that allows PUT to pointer URNs.
@@ -517,7 +521,8 @@
if(!acceptPut)
return doUnknown(req, resf);
- if(!uri.equals("/new-pointer"))
+ if(!uri.equals("/new-pointer") &&
+ !uri.equals("/new-pointer-plain"))
return resf.makeError(404, "Not found");
String formdata =
@@ -554,16 +559,25 @@
}
HTTPResponse resp = resf.makeResponse(203, "Created");
- resp.setField("Content-Type", "text/html");
resp.setField("Location", target.getURI());
- Writer w = new OutputStreamWriter(resp.getOutputStream(),
- "US-ASCII");
- w.write("<html><head><title>Created</title></head><body>");
- w.write("New pointer created at: \n");
- w.write("<a href=\""+id.getURI()+"\">"+id.getURI()+"</a>\n");
- w.write("<p><a href=\"/\">Back to the home page.</a>\n");
- w.write("</body></html>");
- w.close();
+
+ if(uri.equals("/new-pointer-plain")) {
+ resp.setField("Content-Type", "text/plain");
+ Writer w = new OutputStreamWriter(resp.getOutputStream(),
+ "US-ASCII");
+ w.write(id.getURI());
+ w.close();
+ } else {
+ resp.setField("Content-Type", "text/html");
+ Writer w = new OutputStreamWriter(resp.getOutputStream(),
+ "US-ASCII");
+ w.write("<html><head><title>Created</title></head><body>");
+ w.write("New pointer created at: \n");
+ w.write("<a href=\""+id.getURI()+"\">"+id.getURI()+"</a>\n");
+ w.write("<p><a href=\"/\">Back to the home page.</a>\n");
+ w.write("</body></html>");
+ w.close();
+ }
if(dbg) p("Return response");
return resp;
@@ -655,7 +669,9 @@
if(args.length == 1)
new HTTPProxy(pool, 5555).run();
else {
+ System.out.println("FOO");
KeyPair keys = SetPointer.readKeyPair(new File(args[1]));
+ System.out.println("FOO");
new HTTPProxy(pool, 5555, keys).run();
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] storm ./Makefile org/nongnu/storm/http/server/H...,
Benja Fallenstein <=