request.setAttribute(Constants.REQ_ATTR_UPLOAD_DETAILS, new Integer(uploadId));
ActionForward fwd = handler.performUpload(request, response, upload, uploadForm.getUploadFile());
ActionMessages msgs = new ActionMessages();
if(upload.getResourcePath()==null) {
msgs.add(Globals.MESSAGE_KEY, new BundleActionMessage("vfs", "upload.info.fileUploadedNoPath", uploadForm.getUploadFile()
.getFileName()));
} else {
msgs.add(Globals.MESSAGE_KEY, new BundleActionMessage("vfs", "upload.info.fileUploaded", uploadForm.getUploadFile()
.getFileName(), upload.getResourcePath()));
}
saveMessages(request, msgs);
request.setAttribute(Constants.REQ_ATTR_UPLOAD_DETAILS, uploadId);
uploadForm.setUploadId(uploadId);
return fwd;
}
catch (CoreException ce) {
log.error("Failed to upload.", ce);
ActionMessages errs = getErrors(request);
errs.add(Globals.ERROR_KEY, ce.getBundleActionMessage());
saveErrors(request, errs);
if (null != upload.getUploadedForward())
return new RedirectWithMessages(upload.getUploadedForward(), request);
else
throw ce;
}
catch (Exception e) {
log.error("Failed to upload.", e);
ActionMessages msgs = new ActionMessages();
msgs.add(Globals.MESSAGE_KEY, new BundleActionMessage("vfs", "upload.info.fileNotUploaded", e.getMessage()));
saveErrors(request, msgs);
if (null != upload.getUploadedForward())
return upload.getUploadedForward();
else
throw e;