// of this code didn't have any allowed configuration...
mfh.setMaximumAllowedBytes(_maxAllowedBytes);
mfh.setCharacterEncoding(ExternalContextUtils.getCharacterEncoding(externalContext));
final HashMap<String, String[]> parameters = new HashMap<String, String[]>();
MultipartFormItem item;
final UploadedFiles files = new UploadedFiles(externalContext);
while ((item = mfh.getNextPart()) != null)
{
final String name = item.getName();
String value = null;
// No filename - it's not a file uploaded field
if (item.getFilename() == null)
{
value = item.getValue();
final Object oldValue = parameters.get(name);
if (oldValue == null)
{
parameters.put(name, new String[]{value});
}
else
{
final String[] oldArray = (String[]) oldValue;
final String[] newArray = new String[oldArray.length + 1];
System.arraycopy(oldArray, 0, newArray, 1, oldArray.length);
newArray[0] = value;
parameters.put(name, newArray);
}
}
// Upload a file
else if (item.getFilename().length() > 0)
{
_doUploadFile(RequestContext.getCurrentInstance(), externalContext, files, item);
}
}
externalContext.getRequestMap().put(_PARAMS, parameters);