From 80e2f8488b75b0eddf8df3d22a05f5a0481c2c0e Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Mon, 26 Oct 2009 01:54:20 +0100 Subject: [PATCH] A couple of minor cleanups. --- src/dolda/jsvc/j2ee/J2eeRequest.java | 10 ++-------- src/dolda/jsvc/util/Params.java | 10 ++++++++++ src/dolda/jsvc/util/SimpleWriter.java | 4 ++++ 3 files changed, 16 insertions(+), 8 deletions(-) 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) { -- 2.11.0