https://github.com/bluejoe2008/elfinder-2.x-servlet
elfinder-2.x-servlet implements a java servlet for elfinder-2.x connector, elfinder is an Open-source file manager for web
https://github.com/bluejoe2008/elfinder-2.x-servlet
commandexecutor elfinder elfinder-servlet file-explorer web-ui
Last synced: 3 months ago
JSON representation
elfinder-2.x-servlet implements a java servlet for elfinder-2.x connector, elfinder is an Open-source file manager for web
- Host: GitHub
- URL: https://github.com/bluejoe2008/elfinder-2.x-servlet
- Owner: bluejoe2008
- License: bsd-2-clause
- Created: 2013-08-25T03:16:10.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2022-12-16T02:01:14.000Z (almost 3 years ago)
- Last Synced: 2025-05-20T14:04:22.819Z (5 months ago)
- Topics: commandexecutor, elfinder, elfinder-servlet, file-explorer, web-ui
- Language: Java
- Homepage:
- Size: 12 MB
- Stars: 112
- Watchers: 19
- Forks: 80
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
what's elfinder-2.x-servlet
====================[](https://github.com/bluejoe2008/elfinder-2.x-servlet/issues)
[](https://github.com/bluejoe2008/elfinder-2.x-servlet/network)
[](https://github.com/bluejoe2008/elfinder-2.x-servlet/stargazers)
[](https://github.com/bluejoe2008/elfinder-2.x-servlet/blob/master/LICENSE)elfinder-2.x-servlet implements a java servlet for elfinder-2.x connector
elfinder is an Open-source file manager for web, written in JavaScript using jQuery and jQuery UI.
see also http://elfinder.org
for elfinder-1.2 users, please go to https://github.com/Studio-42/elfinder-servlet.
importing elfinder-2.x-servlet
====================
this project is released as an artifact on the central repostoryuse
org.grapheco
elfinder-servlet-2
1.4
classes
to add dependency in your pom.xml
building elfinder-2.x-servlet
====================
the source files includes:* src/main/webapp : a normal j2ee application includes elfinder, WEB-INF...
* src/main/java: source codes for elfinder-servlet
* src/main/resources: source codes for elfinder-servletTo build this project with maven run:
mvn install
to run this project within a jetty container use:
mvn jetty:run
using elfinder-2.x-servlet in your web apps
====================
just use following codes to tell elfinder to connect with server-side servlet:
$(document).ready(function() {
$('#elfinder').elfinder({
url : 'elfinder-servlet/connector',
});
});
in your web.xml, following codes should be added to enable the servlet:
elfinder
org.springframework.web.servlet.DispatcherServlet
elfinder
/elfinder-servlet/*
yes! elfinder-2.x-servlet is developed upon SpringFramework (http://springframework.org)
an example elfinder-servlet.xml configuration is shown below:
A ConnectorServlet is provided for people who do not use spring framework:
elfinder-connector-servlet
org.grapheco.elfinder.servlet.ConnectorServlet
elfinder-connector-servlet
/elfinder-servlet/connector
If you want to customize behavior of ConnectorServlet(see https://github.com/bluejoe2008/elfinder-2.x-servlet/blob/0.9/src/main/java/cn/bluejoe/elfinder/servlet/ConnectorServlet.java), you may need to create a derivided servlet class based on ConnectorServlet.
features
================
* __easy to use__: just define a servlet in your web.xml, or configure the XML file in spring IOC format, and then start your web application
* __easy to import__: an artifact on the central repostory is provided, use maven to manage the dependency
* __logic file views__: a local file system is not necessary, you can define your FsService
* __easy to personalize__: different file views are allowed for different users, just provide a custom FsServiceFactory
* __easy to modify and extend__: provide your own CommandExecutors to respond new commandsCommand, CommandExecutor, CommandExecutorManager
================elfinder-2.x-servlet implements file management commands including:
* DIM
* DUPLICATE
* FILE
* GET
* LS
* MKDIR
* MKFILE
* OPEN
* PARENT
* PASTE
* PUT
* RENAME
* RM
* SEARCH
* SIZE
* TMB
* TREE
* UPLOAD(CHUNK supported!!!)Each command corresponds to a CommandExecutor class, for example, the TREE command is implemented by the class TreeCommandExecutor(see https://github.com/bluejoe2008/elfinder-2.x-servlet/src/main/java/cn/bluejoe/elfinder/controller/executors/TreeCommandExecutor.java). Users can modify existing class or entend new executor class by following this naming rule.
Furthermore, this rule can even be modified via setting the commandExecutorFactory in elfinder-servlet.xml, in which default factory is DefaultCommandExecutorFactory(see https://github.com/bluejoe2008/elfinder-2.x-servlet/src/main/java/cn/bluejoe/elfinder/controller/executor/DefaultCommandExecutorFactory.java). A CommandExecutorFactory tells how to locate the command executor(TreeCommandExecutor as an example) by a given command name("TREE" as an example), it is designed as an interface:
public interface CommandExecutorFactory
{
CommandExecutor get(String commandName);
}FsItem, FsVolume, FsService, FsServiceFactory
================
Each file is represented as a FsItem. And the root of a file is represented as a FsVolume. A FsVolume tells parent-children relations between all FsItems and implements all file operation (for example, create/delete).A FsService may have many FsVolumes. Users can create a FsService via a FsServiceFactory:
public interface FsServiceFactory
{
FsService getFileService(HttpServletRequest request, ServletContext servletContext);
}A simple (and stupid) StaticFsServiceFactory is provided in https://github.com/bluejoe2008/elfinder-2.x-servlet/src/main/java/cn/bluejoe/elfinder/impl/StaticFsServiceFactory.java, which always returns a fixed FsService, despite of whatever it is requested. However, sometimes a FsService should be constructed dynamically according to current Web request. For example, users may own separated file spaces in a network disk service platform, in this case, getFileService() get user principal from current request and offers him/her different file view.