use of com.ngtesting.platform.servlet.PJProgressListener in project ngtesting-platform by aaronchen2k.
the class PJCommonsMultipartResolver method newFileUpload.
protected FileUpload newFileUpload(FileItemFactory fileItemFactory) {
ServletFileUpload upload = new ServletFileUpload(fileItemFactory);
upload.setSizeMax(-1);
if (request != null) {
HttpSession session = request.getSession();
PJProgressListener uploadProgressListener = new PJProgressListener(request);
upload.setProgressListener(uploadProgressListener);
}
return upload;
}
use of com.ngtesting.platform.servlet.PJProgressListener in project ngtesting-platform by aaronchen2k.
the class PJCommonsMultipartResolver method parseRequest.
@Override
public MultipartParsingResult parseRequest(HttpServletRequest request) throws MultipartException {
String encoding = "utf-8";
FileUpload fileUpload = prepareFileUpload(encoding);
PJProgressListener uploadProgressListener = new PJProgressListener(request);
fileUpload.setProgressListener(uploadProgressListener);
try {
List<FileItem> fileItems = ((ServletFileUpload) fileUpload).parseRequest(request);
return parseFileItems(fileItems, encoding);
} catch (FileUploadBase.SizeLimitExceededException ex) {
throw new MaxUploadSizeExceededException(fileUpload.getSizeMax(), ex);
} catch (FileUploadException ex) {
throw new MultipartException("Could not parse multipart servlet request", ex);
}
}
Aggregations