Class FileSystemElFinderConnector<Entry extends IFileSystemEntry<?>>

java.lang.Object
de.xima.fc.gui.elfinder.AServletElFinderConnector<org.primefaces.model.StreamedContent>
de.xima.fc.gui.elfinder.FileSystemElFinderConnector<Entry>
Type Parameters:
Entry - Common super type of all file system entries.
All Implemented Interfaces:
Serializable

public final class FileSystemElFinderConnector<Entry extends IFileSystemEntry<?>> extends AServletElFinderConnector<org.primefaces.model.StreamedContent>
An elFinder connector that serves files from a ICommonFileSystem instance. Based on Java servlets.
Since:
8.3.0
Author:
XIMA MEDIA GmbH
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    checkState(javax.servlet.http.HttpServletRequest request)
    Checks whether the current state of this connector allows the request to be processed.
    protected org.primefaces.model.StreamedContent
    handleCommandAbort(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Abort the specified request
    protected com.alibaba.fastjson.JSONObject
    handleCommandDimensions(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Returns the dimensions of an image / video.
    protected com.alibaba.fastjson.JSONObject
    handleCommandDuplicate(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Creates a duplicate for directories / files.
    protected org.primefaces.model.StreamedContent
    handleCommandFile(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Output file into browser.
    protected com.alibaba.fastjson.JSONObject
    handleCommandGet(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Returns the content as String (As UTF-8).
    protected com.alibaba.fastjson.JSONObject
    handleCommandList(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Return a list of item names in the target directory.
    protected com.alibaba.fastjson.JSONObject
    handleCommandMakeDir(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Create a new directory.
    protected com.alibaba.fastjson.JSONObject
    handleCommandMakeFile(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Create a new blank file.
    protected com.alibaba.fastjson.JSONObject
    handleCommandOpen(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Handles an open request.
    protected com.alibaba.fastjson.JSONObject
    handleCommandParents(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Returns all parent folders and their first level (at least) subfolders and own(target) stat.
    protected com.alibaba.fastjson.JSONObject
    handleCommandPaste(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Copies or moves a directory / files.
    protected com.alibaba.fastjson.JSONObject
    handleCommandPut(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Stores contents data in a file.
    protected com.alibaba.fastjson.JSONObject
    handleCommandRemove(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Recursively removes files and directories.
    protected com.alibaba.fastjson.JSONObject
    handleCommandRename(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Renaming a directory/file.
    protected com.alibaba.fastjson.JSONObject
    handleCommandResize(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Change the size of an image.
    protected com.alibaba.fastjson.JSONObject
    handleCommandSearch(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Return a list of files and folders list, that match the search string. arguments:
    protected com.alibaba.fastjson.JSONObject
    handleCommandSize(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Returns the size of a directory or file.
    protected com.alibaba.fastjson.JSONObject
    handleCommandThumbnail(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Background command.
    protected com.alibaba.fastjson.JSONObject
    handleCommandTree(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Return folder's subfolders.
    protected com.alibaba.fastjson.JSONObject
    handleCommandUploadSimple(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Process file upload requests.
    protected com.alibaba.fastjson.JSONObject
    handleCommandUrl(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Returns the url of a file.
    protected OneOfN.Either<com.alibaba.fastjson.JSONObject, org.primefaces.model.StreamedContent>
    handleCommandZipDownload(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Downloads a set of files as a ZIP archive. 1st request to make temporary archive file on server side. 2nd request to download the archive file.
    static <Entry extends IFileSystemEntry<?>>
    FileSystemElFinderConnector<Entry>
    Creates a new elFinder connector backed by the given content view, using the given settings.
    protected com.alibaba.fastjson.JSONObject
    readRequestJsonPayload(javax.servlet.http.HttpServletRequest req)
     
    protected org.primefaces.model.StreamedContent
    writeResponseJsonPayload(javax.servlet.http.HttpServletResponse response, com.alibaba.fastjson.JSONObject responsePayload)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • checkState

      protected void checkState(javax.servlet.http.HttpServletRequest request) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Checks whether the current state of this connector allows the request to be processed. This method can be overridden by subclasses i.e. to abort the request if the user is not authenticated, or when a session is missing.
      Overrides:
      checkState in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      request - The HTTP request.
      Throws:
      ElfinderConnectorException - When the state is invalid. This will result in an error response to the client.
    • handleCommandAbort

      protected org.primefaces.model.StreamedContent handleCommandAbort(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Description copied from class: AServletElFinderConnector
      Abort the specified request

      Arguments:

      • cmd : abort
      • id : request id to abort

      Response:

      Empty content with HTTP response code "204 No Content"

      Specified by:
      handleCommandAbort in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The abort request payload to handle.
      request - The HTTP request.
      response - The HTTP response.
    • handleCommandDimensions

      protected com.alibaba.fastjson.JSONObject handleCommandDimensions(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Returns the dimensions of an image / video.

      Arguments:

      • cmd: dim
      • target: Hash path of the node
      • substitute : Width in pixel for requesting a substitute image (optional) - API >= 2.1030 When given, the server must return a URL to a thumbnail with the given width.

      Response:

      • dim: The dimensions of the media in the format {width}x{height} (e.g. "640x480").
      • url: The URL to the requested substitute image. (optional)
      Overrides:
      handleCommandDimensions in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The dimensions request payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the dimensions request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandDuplicate

      protected com.alibaba.fastjson.JSONObject handleCommandDuplicate(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Creates a duplicate for directories / files. Copy name is generated as follows:
      basedir_name_filecopy+serialnumber.extension (if any).
      

      Arguments:

      • cmd : duplicate
      • targets[] : An array of hashes for the directories or files to be duplicated

      Response:

      • added (Array) Information about the duplicated files or directories.
      Overrides:
      handleCommandDuplicate in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The duplicate request payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the duplicate request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandFile

      protected org.primefaces.model.StreamedContent handleCommandFile(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Output file into browser. This command applies to download and preview actions.

      Arguments:

      • cmd : file
      • target : file's hash,
      • download : Send headers to force download file instead of opening it in the browser.
      • cpath (API >= 2.1.39) : Cookie path that temporary cookie set up until download starts. If this parameter is specified, the connector must set the cookie name as "elfdl" + Request ID (The value is irrelevant, maybe "1") . This cookie is deleted by the client at the start of download.
      May need to set Content-Disposition, Content-Location and Content-Transfer-Encoding. Content-Disposition should have 'inline' for preview action or 'attachments' for download.
      Overrides:
      handleCommandFile in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The file request payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The binary response object.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandGet

      protected com.alibaba.fastjson.JSONObject handleCommandGet(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Returns the content as String (As UTF-8).

      Arguments:

      • cmd : get
      • current : hash of the directory where the file is stored
      • target : hash of the file
      • conv : instructions for character encoding conversion of the text file
        • 1 : auto detect encoding(Return false as content in response data when failed)
        • 0 : auto detect encoding(Return { "doconv" : "unknown" } as response data when failed)
        • Original Character encoding : original character encoding as specified by the user

      Response:

      • content - file contents (UTF-8 String or Data URI Scheme String) or false
      • encoding - (Optional) Detected original character encoding (Require when converting from encoding other than UTF-8)
      • doconv - (Optional) "doconv":"unknown" is returned to ask the user for the original encoding if automatic conversion to UTF-8 is not possible when requested with conv = 0.
      For files other than text files, content must be returned as string data of Data URI Scheme.
      Overrides:
      handleCommandGet in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The get payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the get request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandList

      protected com.alibaba.fastjson.JSONObject handleCommandList(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Return a list of item names in the target directory.

      Arguments:

      • cmd : ls
      • target : hash of directory,
      • intersect[] : An array of the item names for presence check.

      Response:

      • list : (Object) item names list with hash as key. Return only duplicate files if the intersect[] is specified.
      Overrides:
      handleCommandList in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The ls payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the ls request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandMakeDir

      protected com.alibaba.fastjson.JSONObject handleCommandMakeDir(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Create a new directory.

      Arguments:

      • cmd : mkdir
      • target : hash of target directory,
      • name : New directory name
      • dirs[] : array of new directories path (requests at pre-flight of folder upload)

      Response:

      • added : (Array) Array with a single object - a new directory.
      • hashes : (Object) Object of path in the dirs[] as a key to the corresponding hash value.
      Overrides:
      handleCommandMakeDir in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The mkdir payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the mkdir request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandMakeFile

      protected com.alibaba.fastjson.JSONObject handleCommandMakeFile(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Create a new blank file.

      Arguments:

      • cmd : mkfile
      • target : hash of target directory,
      • name : New file name

      Response:

      • added : (Array) Array with a single object - a new file.
      Overrides:
      handleCommandMakeFile in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The mkfile payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the mkfile request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandOpen

      protected com.alibaba.fastjson.JSONObject handleCommandOpen(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Handles an open request.

      Returns information about requested directory and its content, optionally can return directory tree as files, and options for the current volume.

      Arguments:

      • init : (true|false|not set), optional parameter. If true indicates that this request is an initialization request and its response must include the value api (number or string >= 2) and should include the options object, but will still work without it. Also, this option affects the processing of parameter target hash value. If init == true and target is not set or that directory doesn't exist, then the data connector must return the root directory of the default volume. Otherwise it must return error "File not found".
      • target : (string) Hash of directory to open. Required if init == false or init is not set
      • tree : (true|false), optional. If true, response must contain the top-level object of other volumes.

      Response:

      • api : (Float) The version number of the protocol, must be >= 2.1, ATTENTION - return api ONLY for init request!
      • cwd : (Object) Current Working Directory - information about the current directory.
      • files : (Array) array of objects - files and directories in current directory. If parameter tree == true, then added to the root folder objects of other volumes. The order of files is not important. Information about File/Directory
      • netDrivers : (Array) Network protocols list which can be mounted on the fly (using netmount command). Now only ftp supported.
      • uplMaxFile : (Number) Allowed upload max number of file per request. For example 20
      • uplMaxSize : (String) Allowed upload max size per request. For example "32M"
      • options : (Object) Further information about the folder and its volume
      Overrides:
      handleCommandOpen in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The open request to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the open request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandParents

      protected com.alibaba.fastjson.JSONObject handleCommandParents(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Returns all parent folders and their first level (at least) subfolders and own(target) stat. This command is invoked when a folder is reloaded or there is no data to display the tree of the target folder in the client. Data provided by 'parents' command should enable the correct drawing of tree hierarchy directories.

      Arguments:

      • cmd : parents
      • target : folder's hash
      • until : until to hash, getting parents is enough for that (API >= 2.1024)

      Response:

      • tree : (Array) Folders list.
      Overrides:
      handleCommandParents in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The parents payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the parents request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandPaste

      protected com.alibaba.fastjson.JSONObject handleCommandPaste(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Copies or moves a directory / files.

      Arguments:

      • cmd : paste
      • dst : hash of the directory to which the files will be copied / moved (the destination)
      • targets[] : An array of hashes for the files to be copied / moved
      • cut : 1 if the files are moved, missing if the files are copied
      • renames[] : Filename list of rename request
      • suffix : Suffixes during rename (default is "~")

      Response:

      • added : (Array) array of file and directory objects pasted.
      • removed : (Array) array of file and directory 'hashes' that were successfully deleted

      Caution:

      • If the file name of the rename list exists in the directory, The command should rename the file to "filename + suffix"
      • The command should stop copying at the first error. Is not allowed to overwrite files / directories with the same name. But the behavior of this command depends on some options on connector (if the user uses the default one). Please, take look the options:
      Overrides:
      handleCommandPaste in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The paste payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the paste request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandPut

      protected com.alibaba.fastjson.JSONObject handleCommandPut(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Stores contents data in a file.

      Arguments:

      • cmd : put
      • target : hash of the file
      • content : new contents of the file
      • encoding : character encoding at the time of saving (Text data will be sent by UTF-8) or "scheme" for URL of contents or Data URI scheme
      Content of file data other than text file is sent as string data of Data URI Scheme or URL of new contents with param encoding=scheme.

      Response: An array of successfully uploaded files if success, an error otherwise.

      • changed : (Array) of files that were successfully uploaded. Information about File/Directory
      Overrides:
      handleCommandPut in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The put payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the put request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandRemove

      protected com.alibaba.fastjson.JSONObject handleCommandRemove(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Recursively removes files and directories.

      Arguments:

      • cmd : rm
      • targets[] : (Array) array of file and directory hashes to delete

      Response:

      • removed : (Array) array of file and directory 'hashes' that were successfully deleted
      Overrides:
      handleCommandRemove in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The rm payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the rm request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandRename

      protected com.alibaba.fastjson.JSONObject handleCommandRename(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Renaming a directory/file.

      Arguments:

      • cmd : rename
      • target : hash directory/file renaming
      • name : New name of the directory/file

      Response:

      • added : (Array) array of file and directory objects renamed.
      • removed : (Array) array of file and directory 'hashes' that were successfully removed.
      Overrides:
      handleCommandRename in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The rename payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the rename request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandResize

      protected com.alibaba.fastjson.JSONObject handleCommandResize(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Change the size of an image.

      Arguments:

      • Change the size of an image.
      • mode : 'resize' or 'crop' or 'rotate'
      • target : hash of the image path
      • width : new image width
      • height : new image height
      • x : x of crop (mode='crop')
      • y : y of crop (mode='crop')
      • degree : rotate degree (mode='rotate')
      • quality: compression quality, e.g. for JPEG images
      • bg: CSS hex color string for the background (when rotating)

      Response:

      • changed : (Array) of files that were successfully resized.
      Overrides:
      handleCommandResize in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The resize payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the resize request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandSearch

      protected com.alibaba.fastjson.JSONObject handleCommandSearch(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Return a list of files and folders list, that match the search string. arguments:

      Arguments:

      • cmd : search
      • q : search string
      • target : search target hash (optional)
      • mimes : Array of search target MIME-type (optional)

      Response:

      • files : (Array) array of objects - files and folders list, that match the search string.
      Overrides:
      handleCommandSearch in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The search payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the search request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandSize

      protected com.alibaba.fastjson.JSONObject handleCommandSize(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Returns the size of a directory or file.

      Arguments:

      • cmd : size
      • targets[] : hash paths of the nodes

      Response:

      • size: The total size for all the supplied targets.
      • fileCnt: The total counts of the file for all the supplied targets. (Optional to API >= 2.1025)
      • dirCnt: The total counts of the directory for all the supplied targets. (Optional to API >= 2.1025)
      • sizes: An object of each target size information. (Optional to API >= 2.1030)
      Overrides:
      handleCommandSize in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The size payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the size request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandThumbnail

      protected com.alibaba.fastjson.JSONObject handleCommandThumbnail(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Background command. Creates thumbnails for images that do not have them.

      Arguments:

      • cmd : tmb
      • targets[] : an array of hash path to the directory in which to create thumbnails

      Response:

      • images: An object with the file hash as the key and the thumbnail URL as the value.
      Overrides:
      handleCommandThumbnail in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The thumbnail payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the thumbnail request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandTree

      protected com.alibaba.fastjson.JSONObject handleCommandTree(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Return folder's subfolders.

      Arguments

      • cmd : tree
      • target : folder's hash
      Response
      • tree : (Array) Folders list.
      Overrides:
      handleCommandTree in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The tree payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the tree request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandUploadSimple

      protected com.alibaba.fastjson.JSONObject handleCommandUploadSimple(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Process file upload requests. Client may request the upload of multiple files at once.

      Arguments:

      • cmd : upload
      • target : hash of the directory to upload
      • upload[] : array of multipart files to upload
      • upload_path[] : (optional) array of target directory hash, it has been a pair with upload[]. (specified at folder upload)
      • mtime[] : (optional) array of files UNIX time stamp, it has been a pair with upload[].
      • name[] : (optional) array of files name for suggest, it has been a pair with upload[].
      • renames[] : (optional) array of rename request filenames
      • suffix : (optional) rename suffix
      • hashes[hash] : (optional) array of hash: filename pairs
      • overwrite : (optional) Flag to overwrite or save another name. If "0" is specified and the same name file exists, the connector should save the upload file as a different name.

      Response:

      • added : (Array) of files that were successfully uploaded.
      • warning : (Array) of error messages like a errors. Ony if the files could not be uploaded.
      Overrides:
      handleCommandUploadSimple in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The upload payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the upload request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandUrl

      protected com.alibaba.fastjson.JSONObject handleCommandUrl(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Returns the url of a file. This method is called if the initial value for the file's url is "1".

      Arguments:

      • cmd : url
      • target : hash of file
      • options[] : array of options (?)

      Response:

      • url: url of the file
      Overrides:
      handleCommandUrl in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The url payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the url request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • handleCommandZipDownload

      protected OneOfN.Either<com.alibaba.fastjson.JSONObject, org.primefaces.model.StreamedContent> handleCommandZipDownload(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ElfinderConnectorException
      Description copied from class: AServletElFinderConnector
      Downloads a set of files as a ZIP archive. 1st request to make temporary archive file on server side. 2nd request to download the archive file.

      1st request

      Arguments:

      • cmd : zipdl
      • targets[] : array of hashed paths of the nodes to download

      Response:

      • zipdl: array data for 2nd request
      2nd request

      Arguments:

      • cmd : zipdl
      • download : 1
      • targets[0] : hash path for detect target volume drive (e.g. cwd hash)
      • targets[1] : target temporary archive file key
      • targets[2] : download file name
      • targets[3] : MIME type
      Response: RAW data of archive file with HTTP headers for download
      Overrides:
      handleCommandZipDownload in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
      Parameters:
      payload - The zip download payload to handle.
      request - The HTTP request.
      response - The HTTP response.
      Returns:
      The response to the zip download request.
      Throws:
      ElfinderConnectorException - When the command could not be handled.
    • readRequestJsonPayload

      protected com.alibaba.fastjson.JSONObject readRequestJsonPayload(javax.servlet.http.HttpServletRequest req)
      Specified by:
      readRequestJsonPayload in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
    • writeResponseJsonPayload

      protected org.primefaces.model.StreamedContent writeResponseJsonPayload(javax.servlet.http.HttpServletResponse response, com.alibaba.fastjson.JSONObject responsePayload)
      Specified by:
      writeResponseJsonPayload in class AServletElFinderConnector<org.primefaces.model.StreamedContent>
    • newConnector

      public static <Entry extends IFileSystemEntry<?>> FileSystemElFinderConnector<Entry> newConnector(FileSystemElFinderConnectorConfig<Entry> config)
      Creates a new elFinder connector backed by the given content view, using the given settings. Can handle Java servlet requests.
      Type Parameters:
      Entry - Common super type of all file system entries.
      Parameters:
      config - The configuration for the connector.
      Returns:
      The new elFinder connector.