}
//Do multipart file upload request processing
if (ServletFileUpload.isMultipartContent(new ServletRequestContext(request))) {
//Used to communicate to clients of multipart data if the request processing worked correctly
UploadStatus uploadStatus;
final String encoding = this.determineEncoding(request);
final FileUpload fileUpload = this.prepareFileUpload(encoding);
try {
final List<FileItem> fileItems = ((ServletFileUpload) fileUpload).parseRequest(request);
final MultipartParsingResult parsingResult = parseFileItems(fileItems, encoding);
final Map<String, MultipartDataSource[]> multipartDataSources = this.getMultipartDataSources(parsingResult);
channelParameters.putAll(multipartDataSources);
final Map<String, String[]> multipartParameters = parsingResult.getMultipartParameters();
channelParameters.putAll(multipartParameters);
uploadStatus = new UploadStatus(UploadStatus.SUCCESS, this.getFileUpload().getFileSizeMax());
}
catch (FileUploadException fue) {
this.logger.warn("Failed to parse multipart upload, processing will continue but not all parameters may be available.", fue);
uploadStatus = new UploadStatus(UploadStatus.FAILURE, this.getFileUpload().getFileSizeMax());
ExceptionHelper.genericTopHandler(Errors.bug, fue);
}
channelParameters.put(UPLOAD_STATUS, new UploadStatus[] { uploadStatus });
}