From eb0e45b75c3d0b40f4f8c742e354791f7cb7c0c4 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Mon, 12 Oct 2009 23:12:17 +0200 Subject: [PATCH] Added a convenient toString implementation for multimaps. --- src/dolda/jsvc/test/TestResponder.java | 1 + src/dolda/jsvc/util/WrappedMultiMap.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/dolda/jsvc/test/TestResponder.java b/src/dolda/jsvc/test/TestResponder.java index 1bf4f58..fbe2204 100644 --- a/src/dolda/jsvc/test/TestResponder.java +++ b/src/dolda/jsvc/test/TestResponder.java @@ -18,6 +18,7 @@ public class TestResponder implements Responder { out.println(""); out.println("

Barda

"); out.println("Bardslen."); + out.println(req.inheaders()); out.println(""); out.println(""); out.flush(); diff --git a/src/dolda/jsvc/util/WrappedMultiMap.java b/src/dolda/jsvc/util/WrappedMultiMap.java index 42f211c..e354989 100644 --- a/src/dolda/jsvc/util/WrappedMultiMap.java +++ b/src/dolda/jsvc/util/WrappedMultiMap.java @@ -230,4 +230,18 @@ public class WrappedMultiMap implements MultiMap { } protected void modified() {} + + public String toString() { + StringBuilder buf = new StringBuilder(); + buf.append("{\n"); + for(Map.Entry 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()); + } } -- 2.11.0