]> git.dolda2000.com Git - jsvc.git/commitdiff
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 466b81c7616703440a2f764657dd209efde0e03e..8eb8b90acf4d96d45cf2d6b0bd2f50e5ca865001 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 a0fd46d44a2f0e13931005aa58c6a8b79d8f3307..aac3639dbdaa7b102828e0a1edb328caad219226 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 60f17d29ec5e8b5814909b2b7c2201ede9f0b3ec..0d32da2498cc1158de8c276a2baf1422b29d2805 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) {