From: Fredrik Tolf Date: Mon, 26 Oct 2009 00:54:20 +0000 (+0100) Subject: A couple of minor cleanups. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=80e2f8488b75b0eddf8df3d22a05f5a0481c2c0e;p=jsvc.git A couple of minor cleanups. --- diff --git a/src/dolda/jsvc/j2ee/J2eeRequest.java b/src/dolda/jsvc/j2ee/J2eeRequest.java index 466b81c..8eb8b90 100644 --- a/src/dolda/jsvc/j2ee/J2eeRequest.java +++ b/src/dolda/jsvc/j2ee/J2eeRequest.java @@ -144,14 +144,8 @@ public class J2eeRequest extends ResponseBuffer { } public MultiMap params() { - if(params == null) { - params = Params.urlparams(this); - if(method == "POST") { - MultiMap pp = Params.postparams(this); - if(pp != null) - params.putAll(pp); - } - } + if(params == null) + params = Params.stdparams(this); return(params); } diff --git a/src/dolda/jsvc/util/Params.java b/src/dolda/jsvc/util/Params.java index a0fd46d..aac3639 100644 --- a/src/dolda/jsvc/util/Params.java +++ b/src/dolda/jsvc/util/Params.java @@ -129,4 +129,14 @@ public class Params { } return(null); } + + public static MultiMap stdparams(Request req) { + MultiMap params = Params.urlparams(req); + if(req.method() == "POST") { + MultiMap pp = Params.postparams(req); + if(pp != null) + params.putAll(pp); + } + return(params); + } } diff --git a/src/dolda/jsvc/util/SimpleWriter.java b/src/dolda/jsvc/util/SimpleWriter.java index 60f17d2..0d32da2 100644 --- a/src/dolda/jsvc/util/SimpleWriter.java +++ b/src/dolda/jsvc/util/SimpleWriter.java @@ -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) {