MultipartRequestWrapper wrapper = (MultipartRequestWrapper) request;
ServletRequest origRequest = wrapper.getRequest();
if (origRequest != null && origRequest instanceof RequestWrapper) {
RequestWrapper requestWrapper = (RequestWrapper) origRequest;
Boolean maxLengthExceeded = (Boolean) request.getAttribute(ATTRIBUTE_MAX_LENGTH_EXCEEDED);
if ((maxLengthExceeded != null) && (maxLengthExceeded.booleanValue())) {
return;
}
HdivMultipartException multipartException = (HdivMultipartException) request
.getAttribute(IMultipartConfig.FILEUPLOAD_EXCEPTION);
if (multipartException != null) {
Exception orig = multipartException.getOriginal();
log.error("Failed to parse multipart request", orig);
if (orig instanceof ServletException) {
throw (ServletException) orig;
} else {
throw new ServletException("Failed to parse multipart request", orig);
}
}
// file items
Map<String, Object> items = requestWrapper.getFileElements();
for (Object fileItem : items.values()) {
if (items != null) {
addFileParameter((List) fileItem);
}
}
// text items
items = requestWrapper.getTextElements();
for (String currentTextKey : items.keySet()) {
String[] currentTextValue = (String[]) items.get(currentTextKey);
this.addTextParameter(wrapper, currentTextKey, currentTextValue);