gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java


From: Tuukka Hastrup
Subject: [Gzz-commits] storm/org/nongnu/storm/util HTTPProxy.java
Date: Thu, 08 May 2003 11:12:36 -0400

CVSROOT:        /cvsroot/storm
Module name:    storm
Changes by:     Tuukka Hastrup <address@hidden> 03/05/08 11:12:36

Modified files:
        org/nongnu/storm/util: HTTPProxy.java 

Log message:
        serveHomePage separate method, backlinks works as a dir

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/util/HTTPProxy.java.diff?tr1=1.24&tr2=1.25&r1=text&r2=text

Patches:
Index: storm/org/nongnu/storm/util/HTTPProxy.java
diff -u storm/org/nongnu/storm/util/HTTPProxy.java:1.24 
storm/org/nongnu/storm/util/HTTPProxy.java:1.25
--- storm/org/nongnu/storm/util/HTTPProxy.java:1.24     Thu May  8 10:10:43 2003
+++ storm/org/nongnu/storm/util/HTTPProxy.java  Thu May  8 11:12:36 2003
@@ -105,29 +105,9 @@
                    backlinks = true;
                }
                
-               if(uri.equals("") || uri.equals("rewrite")) {
-                   if(uri.equals("rewrite")) rewrite = true;
-
-                   HTTPResponse resp = resf.makeResponse(200, "Ok");
-                   resp.setField("Content-Type", "text/html");
-                   Writer w = new OutputStreamWriter(resp.getOutputStream(), 
"US-ASCII");
-                   w.write("<html><head><title>Storm gateway</title>" +
-                           "</head><body>\n");
-                   w.write("<h1>Storm gateway</h1>\n");
-
-                   writeRewriteLinks(w, rewrite);
-
-                   for(Iterator i=pool.getIds().block().iterator(); 
-                       i.hasNext();) {
-                       BlockId id = (BlockId)i.next();
-                       String s = id.getURI();
-                       if(rewrite) s = ROOTURL+REWRITE+"/" + s;
-                       w.write("<a href=\""+s+"\">"+id+"</a><br>\n");
-                   }
-                   w.write("</body></html>\n");
-                   w.close();
-                   return resp;
-               }
+               if(uri.equals(""))
+                  return serveHomePage(rewrite, backlinks, resf);
+                   
 
                BlockId id = new BlockId(uri);
 
@@ -231,13 +211,13 @@
                w.write("<p>If your browser <em>is not</em> configured ");
                w.write("to use this gateway as a proxy for URNs, ");
                w.write("you can use ");
-               w.write("<a href=\"rewrite/\">URI-rewriting version</a> ");
+               w.write("<a href=\"/rewrite/\">URI-rewriting version</a> ");
                w.write("instead.</p>\n");
            } else {
                w.write("<p>If your browser <em>is</em> configured ");
                w.write("to use this gateway as a proxy for URNs, ");
                w.write("you can use ");
-               w.write("<a href=\"../\">Non-URI-rewriting version</a> ");
+               w.write("<a href=\"/\">Non-URI-rewriting version</a> ");
                w.write("instead.</p>\n");
            }
            w.write("<p>");
@@ -247,6 +227,36 @@
                    +ROOTURL+URNPAC+"</a></p>\n");
        }
 
+       protected HTTPResponse serveHomePage(boolean rewrite, 
+                                            boolean backlinks,
+                                            HTTPResponse.Factory resf) 
+           throws IOException {
+
+           String base = ROOTURL;
+           if(rewrite) base += REWRITE+"/";
+           if(backlinks) base += BACKLINKS+"/";
+
+           HTTPResponse resp = resf.makeResponse(200, "Ok");
+           resp.setField("Content-Type", "text/html");
+           Writer w = new OutputStreamWriter(resp.getOutputStream(), 
"US-ASCII");
+           w.write("<html><head><title>Storm gateway</title>" +
+                   "</head><body>\n");
+           w.write("<h1>Storm gateway</h1>\n");
+           
+           writeRewriteLinks(w, rewrite);
+
+           for(Iterator i=pool.getIds().block().iterator(); 
+               i.hasNext();) {
+               BlockId id = (BlockId)i.next();
+               String s = id.getURI();
+               if(rewrite) s = ROOTURL+REWRITE+"/" + s;
+               w.write("<a href=\""+s+"\">"+id+"</a><br>\n");
+           }
+           w.write("</body></html>\n");
+           w.close();
+           return resp;
+       }
+       
        protected HTTPResponse serveBlock(String uri, 
                                          HTTPResponse.Factory resf) 
            throws Exception {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]