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 aICommonFileSysteminstance. Based on Java servlets.- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckState(javax.servlet.http.HttpServletRequest request)Checks whether the current state of this connector allows the request to be processed.protected org.primefaces.model.StreamedContenthandleCommandAbort(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Abort the specified requestprotected com.alibaba.fastjson.JSONObjecthandleCommandDimensions(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.JSONObjecthandleCommandDuplicate(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.StreamedContenthandleCommandFile(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Output file into browser.protected com.alibaba.fastjson.JSONObjecthandleCommandGet(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.JSONObjecthandleCommandList(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.JSONObjecthandleCommandMakeDir(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Create a new directory.protected com.alibaba.fastjson.JSONObjecthandleCommandMakeFile(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Create a new blank file.protected com.alibaba.fastjson.JSONObjecthandleCommandOpen(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handles an open request.protected com.alibaba.fastjson.JSONObjecthandleCommandParents(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.JSONObjecthandleCommandPaste(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.JSONObjecthandleCommandPut(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.JSONObjecthandleCommandRemove(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Recursively removes files and directories.protected com.alibaba.fastjson.JSONObjecthandleCommandRename(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Renaming a directory/file.protected com.alibaba.fastjson.JSONObjecthandleCommandResize(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.JSONObjecthandleCommandSearch(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.protected com.alibaba.fastjson.JSONObjecthandleCommandSize(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.JSONObjecthandleCommandThumbnail(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Background command.protected com.alibaba.fastjson.JSONObjecthandleCommandTree(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Return folder's subfolders.protected com.alibaba.fastjson.JSONObjecthandleCommandUploadSimple(com.alibaba.fastjson.JSONObject payload, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Process file upload requests.protected com.alibaba.fastjson.JSONObjecthandleCommandUrl(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.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.protected com.alibaba.fastjson.JSONObjectreadRequestJsonPayload(javax.servlet.http.HttpServletRequest req)protected org.primefaces.model.StreamedContentwriteResponseJsonPayload(javax.servlet.http.HttpServletResponse response, com.alibaba.fastjson.JSONObject responsePayload)-
Methods inherited from class de.xima.fc.gui.elfinder.AServletElFinderConnector
createErrorResponse, getRequestId, handleCommandArchive, handleCommandCallback, handleCommandChangeMode, handleCommandExtract, handleCommandInfo, handleCommandNetMount, handleCommandPing, handleCommandUnknown, handleCommandUploadChunked, handleRequest
-
-
-
-
Method Detail
-
checkState
protected void checkState(javax.servlet.http.HttpServletRequest request) throws ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorChecks 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:
checkStatein classAServletElFinderConnector<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:AServletElFinderConnectorAbort the specified requestArguments:
- cmd : abort
- id : request id to abort
Response:
Empty content with HTTP response code "204 No Content"
- Specified by:
handleCommandAbortin classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorReturns 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:
handleCommandDimensionsin classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorCreates 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:
handleCommandDuplicatein classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorOutput 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.
- Overrides:
handleCommandFilein classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorReturns 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.
- Overrides:
handleCommandGetin classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorReturn 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:
handleCommandListin classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorCreate 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:
handleCommandMakeDirin classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorCreate 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:
handleCommandMakeFilein classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorHandles 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:
handleCommandOpenin classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorReturns 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:
handleCommandParentsin classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorCopies 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:
handleCommandPastein classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorStores 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
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:
handleCommandPutin classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorRecursively 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:
handleCommandRemovein classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorRenaming 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:
handleCommandRenamein classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorChange 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:
handleCommandResizein classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorReturn 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:
handleCommandSearchin classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorReturns 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:
handleCommandSizein classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorBackground 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:
handleCommandThumbnailin classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorReturn folder's subfolders.Arguments
- cmd : tree
- target : folder's hash
Response
- tree : (Array) Folders list.
- Overrides:
handleCommandTreein classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorProcess 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:
handleCommandUploadSimplein classAServletElFinderConnector<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 ElfinderConnectorExceptionDescription copied from class:AServletElFinderConnectorReturns 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:
handleCommandUrlin classAServletElFinderConnector<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:AServletElFinderConnectorDownloads 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
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
- Overrides:
handleCommandZipDownloadin classAServletElFinderConnector<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:
readRequestJsonPayloadin classAServletElFinderConnector<org.primefaces.model.StreamedContent>
-
writeResponseJsonPayload
protected org.primefaces.model.StreamedContent writeResponseJsonPayload(javax.servlet.http.HttpServletResponse response, com.alibaba.fastjson.JSONObject responsePayload)- Specified by:
writeResponseJsonPayloadin classAServletElFinderConnector<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.
-
-