• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

spring-elfinder: 简单的文件管理工具,基于springboot,主要方便集成到项目中去,浏览文 ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

spring-elfinder

开源软件地址:

https://gitee.com/doobo/spring-elfinder

开源软件介绍:

spring-elfinder

简单的文件管理工具,基于springboot2,主要方便集成到项目中去,方便浏览系统文件,如日志、系统定时生成静态页面等

关于权限问题,不在该项目的考虑范围内,自己拦截相关URL即可,也可主动继承ElfinderController实现。集成的md文档编辑器,方便编辑普通文本文件;相关页面调用http接口时,如果localstorage有token或者authorization时,会自动加入的ajx的header上;并添加了执行结束后的消息订阅,方便在文件操作(如:文件上传、删除、压缩、下载)完成后,进行相关业务处理,只要继承CmdObserver抽象类即可。

如何添加

<dependency>    <groupId>com.github.doobo</groupId>    <artifactId>elfinder-api</artifactId>    <version>1.4</version></dependency>

请求示例

文件列表

保存文件

PUT:http://localhost:8080/elfinder/connector传参数:cmd:puttarget:A_c3RhdGljL3NmMS9hcnRpY2xlLm1pbi5qcw_E_Eencoding:UTF-8content:保存内容创建目录,并返回目录hast值,方便上传文件时指定目录http://localhost:8080/elfinder/connector?cmd=mkdir&name=%08abc&target=A_&reqid=178b69b73bdda

基本配置

#添加这个UTF-8对中文文件的支持spring:  http:    encoding:      charset: utf-8      force: true      enabled: true  #大文件上传  servlet:    multipart:      max-file-size: 10GB      max-request-size: 30GB      file-manager:  thumbnail:    width: 80 # 缩略图宽  volumes:    - Node:      source: fileSystem # 暂时只支持本地文件系统      alias: 系统目录 # 目录别名      path: data # 映射目录      isDefault: true # 是否默认打开      locale:      constraint:        locked: false # 文件夹是否锁定        readable: true # 是否可读        writable: true # 是否可写#    - Node:#      source: aliyunoss#      alias: 阿里云 # 目录别名#      path: moore-test1 #bucketName#      isDefault: false # 是否默认打开#      locale:#      constraint:#        locked: false # 文件夹是否锁定#        readable: true # 是否可读#        writable: true # 是否可写#      aliyunDriverConfig:#        endpoint: "oss-cn-beijing.aliyuncs.com"#        #bindedDomain: "cdn-bk1.origocoffee.com"#        accessKeyId: ENC(******)#        accessKeySecret: ENC(******)#是否启用ElfinderController,可自主实现elfinder:  start: true

JSON包排除

<dependency>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-test</artifactId>    <scope>test</scope>    <exclusions>        <exclusion>            <groupId>org.junit.vintage</groupId>            <artifactId>junit-vintage-engine</artifactId>        </exclusion>        <exclusion>            <groupId>com.vaadin.external.google</groupId>            <artifactId>android-json</artifactId>        </exclusion>    </exclusions></dependency>

获取文件上传的系统路径

public static VolumeHandler findTarget(ElfinderStorage elfinderStorage, String hash) {    Target target = elfinderStorage.fromHash(hash);    if (target == null) {        return null;    }    return new VolumeHandler(target, elfinderStorage);}VolumeHandler handler = vo.getVolumeHandlerByHash(hash);//文件存放的系统路径String name = handler.getTarget().toString();

参考文献

该项目参考了:

  1. https://gitee.com/boyuan2000cn/springboot2-elfinder

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap