Added getParameterNames() to avoid distasteful interactions with untyped

Enumerations.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2554 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2009-05-06 20:38:05 +00:00
parent cbf7153a5c
commit 2f7e060653
@@ -22,8 +22,11 @@ package com.samskivert.servlet.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
@@ -48,6 +51,19 @@ public class ParameterUtil
throws DataValidationException;
}
/**
* Returns the names of the parameters of the supplied request in a civilized format.
*/
public static Iterable<String> getParameterNames (HttpServletRequest req)
{
List<String> params = new ArrayList<String>();
Enumeration<?> iter = req.getParameterNames();
while (iter.hasMoreElements()) {
params.add((String)iter.nextElement());
}
return params;
}
/**
* Fetches the supplied parameter from the request. If the parameter does not exist, either
* null or the empty string will be returned depending on the value of the