Added a convenient toString implementation for multimaps.
authorFredrik Tolf <fredrik@dolda2000.com>
Mon, 12 Oct 2009 21:12:17 +0000 (23:12 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Mon, 12 Oct 2009 21:13:12 +0000 (23:13 +0200)
src/dolda/jsvc/test/TestResponder.java
src/dolda/jsvc/util/WrappedMultiMap.java

index 1bf4f58..fbe2204 100644 (file)
@@ -18,6 +18,7 @@ public class TestResponder implements Responder {
        out.println("<body>");
        out.println("<h1>Barda</h1>");
        out.println("Bardslen.");
+       out.println(req.inheaders());
        out.println("</body>");
        out.println("</html>");
        out.flush();
index 42f211c..e354989 100644 (file)
@@ -230,4 +230,18 @@ public class WrappedMultiMap<K, V> implements MultiMap<K, V> {
     }
     
     protected void modified() {}
+    
+    public String toString() {
+       StringBuilder buf = new StringBuilder();
+       buf.append("{\n");
+       for(Map.Entry<K, V> e : entrySet()) {
+           buf.append("\t");
+           buf.append(e.getKey().toString());
+           buf.append(" = \"");
+           buf.append(e.getValue().toString());
+           buf.append("\",\n");
+       }
+       buf.append("}\n");
+       return(buf.toString());
+    }
 }