[Super convenient] Web File Management with One Tag

The few lines of code shown below will enable you to use the WEB file management function.
```jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
     pageEncoding="UTF-8"%>
<%@ taglib prefix="efw" uri="efw" %>
<!DOCTYPE HTML>
<HTML>
<HEAD>
	<efw:Client lang="jp"/>
</HEAD>
<BODY>
	<efw:elFinder home=""/>
</BODY>
</HTML>
```
The screen image is explore style. Drag-and-drop file uploads, uploading and downloading multiple files and folders, right-click menus, etc. are quite vivid.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/d7a75330-09f3-06c4-1cfd-ac998e39cb1e.png)

# Background
elFinder is a fairly famous file management tool. It is created with JavaScript and php. Click here for the Motoie website.

https://github.com/Studio-42/elFinder

If you want to use it in Java, you need to create a connector. efw customized the elFinder JavaScript library, added connectors, and packaged it in a jar file in the form of jsp tags. It is one of the "3rd party connectors" on the elFinder orignal site.

# Get Jar
It can be downloaded from maven.
```xml
<dependency>
    <groupId>io.github.efwgrp</groupId>
    <artifactId>efw</artifactId>
    <version>4.07.029</version>
</dependency>
```
For jdk15 or higher, related jars are required.
```xml
<dependency>
    <groupId>org.openjdk.nashorn</groupId>
    <artifactId>nashorn-core</artifactId>
    <version>15.6</version>
</dependency>
```

# efw's elFinder tag
Usage is simple. The minimal way to write it is as described above. The home attribute is a relative path to the WEB-INF/efw/storage folder of the web application. If you want to use an absolute path, set the isAbs attribute to true.
```jsp
<!--相対パス->
<efw:elFinder home="upload"/>
<!--絶対パス-->
<efw:elFinder home="C:\Windows\Microsoft.NET\Framework64" isAbs="true"/>
```
:::note warn
If you delete a file from elFinder, it will really disappear, so please be careful.
:::
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/bbca21a7-a136-70ce-eee8-66f93f814397.png)

# known limitations
I would like to explain some of the limitations that I know from my experience with actual projects.
## Upload file capacity
Like GigaFile, we have implemented unlimited upload file size. However, since it is not published only through Tomcat, there are often restrictions depending on the deployment environment.

## File count limit
I haven't yet come up with specific numbers for this, but if there are a large number of files in one folder, it will not be possible to keep up with the size and an error will occur. For example, when I home the c:\windows folder, an error occurs. In the case of the original elFinder, the error is avoided by stopping obtaining the folder size.

If there are tens of thousands of files directly under one folder, it is assumed that the JSON data needed to display them will become huge and memory overflow will occur.

# Explanation
For details of the API, see the link below.
https://github.com/efwGrp/efw4.X/blob/master/help/tag.elfinder.md
The main attributes and methods are absolute/relative paths, protection, home folder settings, and read-only flag switching. Without absolute path protection, it is extremely dangerous on the Internet. Assuming a simple hack of browser console JavaScript execution, if you find ".." in the home folder name, it is an error. Also, in protected mode, setting the home folder and read-only flag causes an error.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/2ec89362-a0a8-2346-dbe6-4a8b1f7bdff4.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/7e3b13fd-3aac-359f-d79b-827f0d6841a3.png)

# Preview feature introduction
Select a file and press the space bar or the preview icon to bring up the preview screen. You can preview images, PDFs, Office files, etc.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/23c66401-98f5-78de-5df1-9e2e06a919f2.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/ee2793fc-b63a-82b4-2985-3f4d8f8b678f.png)
The extension is required for Office file preview.

https://chromewebstore.google.com/detail/%E3%83%89%E3%82%AD%E3%83%A5%E3%83%A1%E3%83%B3%E3%83%88%E3%80%81%E3%82%B9%E3%83%97%E3%83%AC%E3%83%83%E3%83%89%E3%82%B7%E3%83%BC%E3%83%88%E3%80%81%E3%82%B9%E3%83%A9%E3%82%A4%E3%83%89%E3%81%A7-off/gbkeegbaiigmenfmjfclcdgdpimamgkj?hl=ja&utm_source=chrome-ntp-launcher



The above evidence program can be obtained from the link below.

https://github.com/efwGrp/qittaSamples