upload.setHeaderEncoding(encoding);
parts = upload.parseRequest(request, _thresholdSize, _maxSize, _repositoryPath);
}
catch (FileUploadException ex)
{
throw new ApplicationRuntimeException(
Tapestry.format("DefaultMultipartDecoder.unable-to-decode", ex.getMessage()),
ex);
}
int count = Tapestry.size(parts);
for (int i = 0; i < count; i++)
{
FileItem uploadItem = (FileItem) parts.get(i);
if (uploadItem.isFormField())
{
try
{
String name = uploadItem.getFieldName();
String value;
if (encoding == null)
value = uploadItem.getString();
else
value = uploadItem.getString(encoding);
ValuePart valuePart = (ValuePart) partMap.get(name);
if (valuePart != null)
{
valuePart.add(value);
}
else
{
valuePart = new ValuePart(value);
partMap.put(name, valuePart);
}
}
catch (UnsupportedEncodingException ex)
{
throw new ApplicationRuntimeException(
Tapestry.format("illegal-encoding", encoding),
ex);
}
}
else