* @return <code>ActionForward<code> The result of the action.
* @throws Exception if aan exception is thrown.
*/
public ActionForward mkdir(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception {
FileSystemForm fileSystemForm = (FileSystemForm) form;
checkLaunchSession(request, response, fileSystemForm);
ActionForward fwd = checkAccess(mapping, fileSystemForm, request);
if (fwd != null) {
return fwd;
}
String path = DAVUtilities.stripTrailingSlash(fileSystemForm.getPath() + "/" + fileSystemForm.getNewFolder()) + "/";
VFSResource res = null;
res = getResourceForPath(fileSystemForm.getLaunchSession(), request, response, path);
fwd = checkMount(res, mapping, fileSystemForm, request);
if (fwd != null) {
return fwd;
}
try {
res.makeCollection();
fileSystemForm.setPath(path);
if (res.getMount().getStore().getProvider().isFireEvents()) {
CoreServlet.getServlet().fireCoreEvent(NetworkPlaceResourceType.getResourceAccessMkDirEvent(this,
fileSystemForm.getLaunchSession(),
request,
fileSystemForm.getPath(),
fileSystemForm.getFullURI(),
null));
}
} catch (DAVException e) {
if (res.getMount().getStore().getProvider().isFireEvents()) {
CoreServlet.getServlet().fireCoreEvent(NetworkPlaceResourceType.getResourceAccessMkDirEvent(this,
fileSystemForm.getLaunchSession(),
request,
fileSystemForm.getPath(),
fileSystemForm.getFullURI(),
e));
}
if (e.getStatus() == 405) {
ActionMessages msgs = getErrors(request);
msgs.add(Globals.ERROR_KEY, new BundleActionMessage(NetworkPlacePlugin.MESSAGE_RESOURCES_KEY, "vfs.folder.exists", fileSystemForm.getNewFolder()));
saveErrors(request, msgs);
return mapping.findForward("list");
} else if (e.getStatus() == 507) {
ActionMessages msgs = getErrors(request);
msgs.add(Globals.ERROR_KEY, new BundleActionMessage(NetworkPlacePlugin.MESSAGE_RESOURCES_KEY, "vfs.folder.not.allowed", fileSystemForm.getNewFolder()));
saveErrors(request, msgs);
return mapping.findForward("list");
} else {
throw e;
}