A couple of minor cleanups.
authorFredrik Tolf <fredrik@dolda2000.com>
Mon, 26 Oct 2009 00:54:20 +0000 (01:54 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Mon, 26 Oct 2009 00:54:20 +0000 (01:54 +0100)
src/dolda/jsvc/j2ee/J2eeRequest.java
src/dolda/jsvc/util/Params.java
src/dolda/jsvc/util/SimpleWriter.java

index 466b81c..8eb8b90 100644 (file)
@@ -144,14 +144,8 @@ public class J2eeRequest extends ResponseBuffer {
     }
     
     public MultiMap<String, String> params() {
-       if(params == null) {
-           params = Params.urlparams(this);
-           if(method == "POST") {
-               MultiMap<String, String> pp = Params.postparams(this);
-               if(pp != null)
-                   params.putAll(pp);
-           }
-       }
+       if(params == null)
+           params = Params.stdparams(this);
        return(params);
     }
     
index a0fd46d..aac3639 100644 (file)
@@ -129,4 +129,14 @@ public class Params {
        }
        return(null);
     }
+    
+    public static MultiMap<String, String> stdparams(Request req) {
+       MultiMap<String, String> params = Params.urlparams(req);
+       if(req.method() == "POST") {
+           MultiMap<String, String> pp = Params.postparams(req);
+           if(pp != null)
+               params.putAll(pp);
+       }
+       return(params);
+    }
 }
index 60f17d2..0d32da2 100644 (file)
@@ -10,6 +10,10 @@ public abstract class SimpleWriter implements Responder {
        this.ctype = ctype;
     }
     
+    public SimpleWriter() {
+       this("html");
+    }
+    
     public abstract void respond(Request req, PrintWriter out);
     
     public void respond(Request req) {