在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:spring-elfinder开源软件地址:https://gitee.com/doobo/spring-elfinder开源软件介绍:spring-elfinder
关于权限问题,不在该项目的考虑范围内,自己拦截相关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(); 参考文献该项目参考了: |
请发表评论