From 573d8d53fa60965e5f0705caef8af56b1ac48454 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Sat, 24 Aug 2013 13:03:23 +0200 Subject: [PATCH] Add ServletTools class. --- src/fr/devinsy/kiss4web/ServletTools.java | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/fr/devinsy/kiss4web/ServletTools.java diff --git a/src/fr/devinsy/kiss4web/ServletTools.java b/src/fr/devinsy/kiss4web/ServletTools.java new file mode 100644 index 0000000..1f75f92 --- /dev/null +++ b/src/fr/devinsy/kiss4web/ServletTools.java @@ -0,0 +1,49 @@ +package fr.devinsy.kiss4web; + +import java.util.Enumeration; + +import javax.servlet.http.HttpServletRequest; + +import fr.devinsy.util.StringList; + +/** + * + */ +public class ServletTools +{ + /** + * + * @param request + * @return + */ + public static String showParameters(final HttpServletRequest request) + { + String result; + + // + StringList buffer = new StringList(); + + // + boolean ended = false; + Enumeration names = request.getParameterNames(); + buffer.appendln("Parameter list:"); + while (!ended) + { + if (names.hasMoreElements()) + { + String name = names.nextElement(); + buffer.append("[").append(name).append("]=[").append(request.getParameter(name)).appendln("]"); + } + else + { + ended = true; + } + } + + // + result = buffer.toString(); + + // + return result; + } +} \ No newline at end of file