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 Details

  • Method Details

    • getResourceType

      public ResourceType getResourceType()
      Returns:
      resource type of current working directory
    • getBackend

      public Backend getBackend()
      Returns:
      backend of current working directory
    • listFiles

      public List<File> listFiles() throws IOException
      Returns:
      list of files in current working directory
      Throws:
      IOException - in case of any processing exception
    • writeFile

      public void writeFile(String fileName, InputStream inputStream)
      Writes file to current working directory.
      Parameters:
      fileName - file name
      inputStream - file data input stream
    • hasFile

      public boolean hasFile(String fileName)
      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

      public long getFileSize(String fileName)
      Returns the size of file with given name.
      Parameters:
      fileName - file name
      Returns:
      file size in bytes
    • readFile

      public InputStream readFile(String fileName)
      Parameters:
      fileName - file name
      Returns:
      file data input stream
    • listFolders

      public List<Folder> listFolders() throws IOException
      Returns:
      list of folders in current working directory
      Throws:
      IOException - in case of any processing exception
    • renameFile

      public String renameFile(String fileName, String newFileName)
      Renames file in current working directory.
      Parameters:
      fileName - existing file name
      newFileName - new file name
      Returns:
      new file name, which might be different than requested file name because of sanitization
    • createFolder

      public String createFolder(String folderName)
      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

      public String rename(String newFolderName)
      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

      public String getCurrentFolderPath()
      Returns:
      this working folder path (the returned path is resource type relative)
    • getParentFolderPath

      public String getParentFolderPath()
      Returns:
      parent folder path of this working folder (the returned path is resource type relative)
    • getUrl

      public String getUrl()
      Returns:
      base URL of current folder or null if it's not configured
    • buildProxyCommandUrl

      protected String buildProxyCommandUrl(String fileName, String resizedImageFileName)
      Returns a URL to a file. The URL returned by this method points to Proxy command.
      Parameters:
      fileName - file name
      resizedImageFileName - file name of resized image (ignored if null)
      Returns:
      URL to a file that points to Proxy command
    • getFileUrl

      public String getFileUrl(String fileName)
      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

      public String getResizedImageUrl(String fileName, String resizedImageFileName)
      /** Returns URL to resized image file with given name located in current working directory.
      Parameters:
      fileName - file name
      resizedImageFileName - file name of resized image (ignored if null)
      Returns:
      URL to resized image file located in current working directory
    • getAclResult

      public AclResult getAclResult()
      Returns:
      the ACL result computed for current user and current working directory
    • validateDoubleExtensions

      public void validateDoubleExtensions(String fileName)
      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