All Projects → bluejoe2008 → Elfinder 2.x Servlet

bluejoe2008 / Elfinder 2.x Servlet

Licence: bsd-2-clause
elfinder-2.x-servlet implements a java servlet for elfinder-2.x connector, elfinder is an Open-source file manager for web

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Elfinder 2.x Servlet

ServerTools
ServerTools is Pocketmine-MP plugin containing a set of tools that allows you to manage your server directly from the game!
Stars: ✭ 23 (-80.17%)
Mutual labels:  file-explorer
Cfiles
A ncurses file manager written in C with vim like keybindings
Stars: ✭ 319 (+175%)
Mutual labels:  file-explorer
Chadtree
File manager for Neovim. Better than NERDTree.
Stars: ✭ 653 (+462.93%)
Mutual labels:  file-explorer
file-tree-alternative
This Obsidian Plugin allows users to have a different file explorer experience.
Stars: ✭ 167 (+43.97%)
Mutual labels:  file-explorer
kaktree
File explorer side panel for Kakoune
Stars: ✭ 39 (-66.38%)
Mutual labels:  file-explorer
Nvim Tree.lua
A file explorer tree for neovim written in lua
Stars: ✭ 383 (+230.17%)
Mutual labels:  file-explorer
js-fileexplorer
A zero dependencies, customizable, pure Javascript widget for navigating, managing, uploading, and downloading files and folders or other hierarchical object structures on any modern web browser.
Stars: ✭ 124 (+6.9%)
Mutual labels:  file-explorer
Multitype Filepicker
This is a light Android file picker library.
Stars: ✭ 1,332 (+1048.28%)
Mutual labels:  file-explorer
Chonky
😸 A File Browser component for React.
Stars: ✭ 313 (+169.83%)
Mutual labels:  file-explorer
Kodexplorer
A web based file manager,web IDE / browser based code editor
Stars: ✭ 5,490 (+4632.76%)
Mutual labels:  file-explorer
vue-fs
A Vue file management client, complete with a node/express/FS backend.
Stars: ✭ 40 (-65.52%)
Mutual labels:  file-explorer
drex.nvim
Another directory/file explorer for Neovim written in Lua
Stars: ✭ 15 (-87.07%)
Mutual labels:  file-explorer
Ranger.vim
Ranger integration in vim and neovim
Stars: ✭ 510 (+339.66%)
Mutual labels:  file-explorer
xplr
A hackable, minimal, fast TUI file explorer
Stars: ✭ 2,271 (+1857.76%)
Mutual labels:  file-explorer
Godmode9
GodMode9 Explorer - A full access file browser for the Nintendo 3DS console
Stars: ✭ 1,132 (+875.86%)
Mutual labels:  file-explorer
telescope-file-browser.nvim
File Browser extension for telescope.nvim
Stars: ✭ 674 (+481.03%)
Mutual labels:  file-explorer
Filemanager
React based FileManager for browser ( + FS REST API for Node.js and Express)
Stars: ✭ 378 (+225.86%)
Mutual labels:  file-explorer
Anexplorer
📁 Another Android Explorer ( File Manager ) is an All-in-One Open source file manager. AnExplorer File Manager (File Explorer) is designed for all android devices including Phones, Phablets, Tablets, Chromecast, Wear OS, Android TV and Chromebooks. It's a fully designed with Material guidelines by Google.
Stars: ✭ 1,505 (+1197.41%)
Mutual labels:  file-explorer
Treemacs
Stars: ✭ 1,270 (+994.83%)
Mutual labels:  file-explorer
Fern.vim
🌿 General purpose asynchronous tree viewer written in Pure Vim script
Stars: ✭ 552 (+375.86%)
Mutual labels:  file-explorer

what's elfinder-2.x-servlet

GitHub issues GitHub forks GitHub stars GitHub 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 repostory

use

<dependency>
    <groupId>org.grapheco</groupId>
    <artifactId>elfinder-servlet-2</artifactId>
    <version>1.4</version>
    <classifier>classes</classifier>
</dependency>

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-servlet

To 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:

	<script type="text/javascript" charset="utf-8">
		$(document).ready(function() {
			$('#elfinder').elfinder({
				url : 'elfinder-servlet/connector',
			});
		});
	</script>

in your web.xml, following codes should be added to enable the servlet:

<servlet>
	<servlet-name>elfinder</servlet-name>
	<servlet-class>org.springframework.web.servlet.DispatcherServlet
	</servlet-class>
</servlet>

<servlet-mapping>
	<servlet-name>elfinder</servlet-name>
	<url-pattern>/elfinder-servlet/*</url-pattern>
</servlet-mapping>

yes! elfinder-2.x-servlet is developed upon SpringFramework (http://springframework.org)

an example elfinder-servlet.xml configuration is shown below:

<!-- find appropriate  command executor for given command-->
<bean id="commandExecutorFactory"
	class="org.grapheco.elfinder.controller.executor.DefaultCommandExecutorFactory">
	<property name="classNamePattern"
		value="org.grapheco.elfinder.controller.executors.%sCommandExecutor" />
	<property name="map">
		<map>
		<!-- 
			<entry key="tree">
				<bean class="org.grapheco.elfinder.controller.executors.TreeCommandExecutor" />
			</entry>
		-->
		</map>
	</property>
</bean>

<!-- FsService is often retrieved from HttpRequest -->
<!-- while a static FsService is defined here -->
<bean id="fsServiceFactory" class="org.grapheco.elfinder.impl.StaticFsServiceFactory">
	<property name="fsService">
		<bean class="org.grapheco.elfinder.impl.DefaultFsService">
			<property name="serviceConfig">
				<bean class="org.grapheco.elfinder.impl.DefaultFsServiceConfig">
					<property name="tmbWidth" value="80" />
				</bean>
			</property>
			<property name="volumeMap">
				<!-- two volumes are mounted here -->
				<map>
					<entry key="A">
						<bean class="org.grapheco.elfinder.localfs.LocalFsVolume">
							<property name="name" value="MyFiles" />
							<property name="rootDir" value="/tmp/a" />
						</bean>
					</entry>
					<entry key="B">
						<bean class="org.grapheco.elfinder.localfs.LocalFsVolume">
							<property name="name" value="Shared" />
							<property name="rootDir" value="/tmp/b" />
						</bean>
					</entry>
				</map>
			</property>
			<property name="securityChecker">
				<bean class="org.grapheco.elfinder.impl.FsSecurityCheckerChain">
					<property name="filterMappings">
						<list>
							<bean class="org.grapheco.elfinder.impl.FsSecurityCheckFilterMapping">
								<property name="pattern" value="A_.*" />
								<property name="checker">
									<bean class="org.grapheco.elfinder.impl.FsSecurityCheckForAll">
										<property name="readable" value="true" />
										<property name="writable" value="true" />
									</bean>
								</property>
							</bean>
							<bean class="org.grapheco.elfinder.impl.FsSecurityCheckFilterMapping">
								<property name="pattern" value="B_.*" />
								<property name="checker">
									<bean class="org.grapheco.elfinder.impl.FsSecurityCheckForAll">
										<property name="readable" value="true" />
										<property name="writable" value="false" />
									</bean>
								</property>
							</bean>
						</list>
					</property>
				</bean>
			</property>
		</bean>
	</property>
</bean>

A ConnectorServlet is provided for people who do not use spring framework:

<servlet>
	<servlet-name>elfinder-connector-servlet</servlet-name>
	<servlet-class>org.grapheco.elfinder.servlet.ConnectorServlet
	</servlet-class>
</servlet>
<servlet-mapping>
	<servlet-name>elfinder-connector-servlet</servlet-name>
	<url-pattern>/elfinder-servlet/connector</url-pattern>
</servlet-mapping>

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 commands

Command, 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].