Add ServletTools class.

This commit is contained in:
Christian P. MOMON 2013-08-24 13:03:23 +02:00
parent 98e719f898
commit 573d8d53fa

View file

@ -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<String> 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;
}
}