getResponse = GetResponse.getInvalidCurrentFolderError();
else {
// in contrast to doPost the referrer has to send an explicit type
ResourceType type = context.getResourceType();
Command command = context.getCommand();
// check permissions for user action
if ((command.equals(Command.GET_FOLDERS) || command.equals(Command.GET_FOLDERS_AND_FILES))
&& !RequestCycleHandler.isGetResourcesEnabled(request))
getResponse = GetResponse.getGetResourcesDisabledError();
else if (command.equals(Command.CREATE_FOLDER) && !RequestCycleHandler.isCreateFolderEnabled(request))
getResponse = GetResponse.getCreateFolderDisabledError();
else {
// make the connector calls, catch its exceptions and generate
// the proper response object
try {
if (command.equals(Command.CREATE_FOLDER)) {
String newFolderNameStr = request
.getParameter("NewFolderName");
logger.debug("Parameter NewFolderName: {}",
newFolderNameStr);
String sanitizedNewFolderNameStr = UtilsFile
.sanitizeFolderName(newFolderNameStr);
if (Utils.isEmpty(sanitizedNewFolderNameStr))
getResponse = GetResponse
.getInvalidNewFolderNameError();
else {
logger.debug(
"Parameter NewFolderName (sanitized): {}",
sanitizedNewFolderNameStr);
connector.createFolder(type, context
.getCurrentFolderStr(),
sanitizedNewFolderNameStr);
getResponse = GetResponse.getOK();
}
} else if (command.equals(Command.GET_FOLDERS)
|| command
.equals(Command.GET_FOLDERS_AND_FILES)) {
String url = UtilsResponse.getUrl(RequestCycleHandler
.getUserFilesPath(request), type, context
.getCurrentFolderStr());
getResponse = getFoldersAndOrFiles(command, type, context