Validate.notNull(request, "Null request parameter");
FileItemFactory fileItemFactory = createFileItemFactory(request);
FileUploadBase fileUpload = new ServletFileUpload();
fileUpload.setFileItemFactory(fileItemFactory);
if (fileSizeMax > 0) {
fileUpload.setFileSizeMax(fileSizeMax);
}
if (sizeMax > 0) {
fileUpload.setSizeMax(sizeMax);
}
ServletRequestContext requestContext = new ServletRequestContext(request);
return fileUpload.parseRequest(requestContext);
}