Never set a string array instead of a string HTTP parameter, but

if more than one value is present, additionally set an array parameter
with the name paramname_array (i.e. _array appended to the parameter
name)..
This commit is contained in:
hns 2001-08-30 22:28:46 +00:00
parent 4cd1f12700
commit 00fe000d78
2 changed files with 8 additions and 6 deletions

View file

@ -129,10 +129,11 @@ public abstract class AbstractServletClient extends HttpServlet {
// Params parsen // Params parsen
String nextKey = (String)e.nextElement(); String nextKey = (String)e.nextElement();
String[] paramValues = request.getParameterValues(nextKey); String[] paramValues = request.getParameterValues(nextKey);
if (paramValues != null && paramValues.length == 1) if (paramValues != null) {
reqtrans.set (nextKey, paramValues[0]); // set to single string value reqtrans.set (nextKey, paramValues[0]); // set to single string value
else if (paramValues != null) if (paramValues.length > 1)
reqtrans.set (nextKey, paramValues); // set to string array reqtrans.set (nextKey+"_array", paramValues); // set string array
}
} }
String contentType = request.getContentType(); String contentType = request.getContentType();

View file

@ -101,10 +101,11 @@ public class AcmeServletClient extends HttpServlet {
// Params parsen // Params parsen
String nextKey = (String)e.nextElement(); String nextKey = (String)e.nextElement();
String[] paramValues = request.getParameterValues(nextKey); String[] paramValues = request.getParameterValues(nextKey);
if (paramValues != null && paramValues.length == 1) if (paramValues != null) {
reqtrans.set (nextKey, paramValues[0]); // set to single string value reqtrans.set (nextKey, paramValues[0]); // set to single string value
else if (paramValues != null) if (paramValues.length > 1)
reqtrans.set (nextKey, paramValues); // set to string array reqtrans.set (nextKey+"_array", paramValues); // set string array
}
} }
String contentType = request.getContentType(); String contentType = request.getContentType();