I'm trying to understand how the ServletRequest works.
For example: http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getParameterNames()
States "Returns an Enumeration of String objects containing the names of the parameters contained in this request"
I have seen an instance of this as such
Enumeration test_enum = request.getParameterNames();
StringBuilder sb = new StringBuilder();
while (test_enum.hasMoreElements()) {
String paramName = cleanString((String)test_enum.nextElement());
String paramValue = cleanString(request.getParameter(paramName));
if (alteredValues.containsKey(paramName)) paramValue = alteredValues.get(paramName);
try {
paramValue = URLEncoder.encode(paramValue, "UTF-8");
} catch (UnsupportedEncodingException e) {
}
sb.append("&").append(paramName).append("=").append(paramValue);
}
So I understand that the goal of this is to find all parameters and list them out in URL format.
The thing I don't understand is how getParameterNames() finds the parameters on the page, does it just look for any element with a name attribute and counts that as a parameter?
What qualifies as a parameter in this case?