Package com.cksource.ckfinder.filesystem
Class WorkingFolder
java.lang.Object
com.cksource.ckfinder.filesystem.WorkingFolder
@Component
@Lazy
@Scope(value="request",
proxyMode=TARGET_CLASS)
public class WorkingFolder
extends Object
Request scoped service that represents current working directory.
Current working directory is determined by two request parameters: type
and currentFolder
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Acl
protected AclResult
protected String
protected Config
protected static Logger
protected HttpServletRequest
protected ResourceType
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildProxyCommandUrl
(String fileName, String resizedImageFileName) Returns a URL to a file.createFolder
(String folderName) Creates an empty folder in current working directory.void
delete()
Removes current working folder.int
long
getFileSize
(String fileName) Returns the size of file with given name.getFileUrl
(String fileName) Returns URL to file with given name located in current working directory.getResizedImageUrl
(String fileName, String resizedImageFileName) /** Returns URL to resized image file with given name located in current working directory.getUrl()
boolean
Checks if current working directory contains a file with given name.Renames the folder of current working directory.renameFile
(String fileName, String newFileName) Renames file in current working directory.void
validateDoubleExtensions
(String fileName) Validates double extensions of given file name.void
writeFile
(String fileName, InputStream inputStream) Writes file to current working directory.
-
Field Details
-
logger
-
clientCurrentFolder
-
acl
-
aclResult
-
resourceType
-
config
-
request
-
-
Method Details
-
getResourceType
- Returns:
- resource type of current working directory
-
getBackend
- Returns:
- backend of current working directory
-
listFiles
- Returns:
- list of files in current working directory
- Throws:
IOException
- in case of any processing exception
-
writeFile
Writes file to current working directory.- Parameters:
fileName
- file nameinputStream
- file data input stream
-
hasFile
Checks if current working directory contains a file with given name.- Parameters:
fileName
- file name- Returns:
- true if current working directory contains a file with given name
-
getFileSize
Returns the size of file with given name.- Parameters:
fileName
- file name- Returns:
- file size in bytes
-
readFile
- Parameters:
fileName
- file name- Returns:
- file data input stream
-
listFolders
- Returns:
- list of folders in current working directory
- Throws:
IOException
- in case of any processing exception
-
renameFile
Renames file in current working directory.- Parameters:
fileName
- existing file namenewFileName
- new file name- Returns:
- new file name, which might be different than requested file name because of sanitization
-
createFolder
Creates an empty folder in current working directory.- Parameters:
folderName
- the name of folder to create- Returns:
- new folder name, which might be different than requested folder name because of sanitization
-
rename
Renames the folder of current working directory.- Parameters:
newFolderName
- new folder name- Returns:
- new folder name, which might be different than requested folder name because of sanitization
-
delete
public void delete()Removes current working folder. -
getCurrentFolderPath
- Returns:
- this working folder path (the returned path is resource type relative)
-
getParentFolderPath
- Returns:
- parent folder path of this working folder (the returned path is resource type relative)
-
getUrl
- Returns:
- base URL of current folder or
null
if it's not configured
-
buildProxyCommandUrl
Returns a URL to a file. The URL returned by this method points toProxy
command.- Parameters:
fileName
- file nameresizedImageFileName
- file name of resized image (ignored ifnull
)- Returns:
- URL to a file that points to
Proxy
command
-
getFileUrl
Returns URL to file with given name located in current working directory.- Parameters:
fileName
- file name- Returns:
- URL to file with given name located in current working directory
-
getResizedImageUrl
/** Returns URL to resized image file with given name located in current working directory.- Parameters:
fileName
- file nameresizedImageFileName
- file name of resized image (ignored ifnull
)- Returns:
- URL to resized image file located in current working directory
-
getAclResult
- Returns:
- the ACL result computed for current user and current working directory
-
validateDoubleExtensions
Validates double extensions of given file name.- Parameters:
fileName
- file name
-
getAclMask
public int getAclMask()- Returns:
- ACL mask computed for current user and current working directory
-