Add ServletTools class.
This commit is contained in:
parent
98e719f898
commit
573d8d53fa
1 changed files with 49 additions and 0 deletions
49
src/fr/devinsy/kiss4web/ServletTools.java
Normal file
49
src/fr/devinsy/kiss4web/ServletTools.java
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue