文件组件
| 27 | * 文件组件 |
| 28 | */ |
| 29 | @Component("fileComponent") |
| 30 | public class FileComponent { |
| 31 | @Resource SettingRepository settingRepository; |
| 32 | @Resource LocalFileComponent localFileComponent; |
| 33 | @Resource TextFilterComponent textFilterComponent; |
| 34 | @Resource ThumbnailComponent thumbnailComponent; |
| 35 | |
| 36 | /** |
| 37 | * 获得正在使用的文件存储系统 |
| 38 | * @return 0.本地系统 10.SeaweedFS 20.MinIO 30.阿里云OSS |
| 39 | */ |
| 40 | public int getFileSystem(){ |
| 41 | return 0;//本地文件存储系统 |
| 42 | |
| 43 | } |
| 44 | |
| 45 | |
| 46 | /** |
| 47 | * 获取文件服务器随机地址 如http://s3-1.diyhi.com/ |
| 48 | * 如有多个地址,则随机返回一个地址,分布式文件存储系统服务器会自动302跳转(302暂时性转移)到正确的地址 |
| 49 | * 本地文件存储系统返回‘空值’ |
| 50 | * @return |
| 51 | */ |
| 52 | public String fileServerAddress(){ |
| 53 | return this.fileServerAddress(null); |
| 54 | } |
| 55 | /** |
| 56 | * 获取文件服务器随机地址 如http://s3-1.diyhi.com/ |
| 57 | * 如有多个地址,则随机返回一个地址,分布式文件存储系统服务器会自动302跳转(302暂时性转移)到正确的地址 |
| 58 | * 本地文件存储系统返回‘访问地址’ |
| 59 | * @param request |
| 60 | * @return |
| 61 | */ |
| 62 | public String fileServerAddress(HttpServletRequest request){ |
| 63 | if(request != null){ |
| 64 | return WebUtil.getUrl(request);//本地文件存储系统 |
| 65 | } |
| 66 | return ""; |
| 67 | } |
| 68 | /** |
| 69 | * 获取文件服务器所有地址 如http://s3-1.diyhi.com/ |
| 70 | * 如有多个地址,分布式文件存储系统服务器会自动302跳转(302暂时性转移)到正确的地址 |
| 71 | * 本地文件存储系统返回‘空值’ |
| 72 | * @return |
| 73 | */ |
| 74 | public List<String> fileServerAllAddress(){ |
| 75 | return this.fileServerAllAddress(null); |
| 76 | } |
| 77 | /** |
| 78 | * 获取文件服务器所有地址 如http://s3-1.diyhi.com/ |
| 79 | * 如有多个地址,分布式文件存储系统服务器会自动302跳转(302暂时性转移)到正确的地址 |
| 80 | * 本地文件存储系统返回‘访问地址’ |
| 81 | * @return |
| 82 | */ |
| 83 | public List<String> fileServerAllAddress(HttpServletRequest request){ |
| 84 | if(request != null){ |
| 85 | List<String> newEndpoint = new ArrayList<String>(); |
| 86 | newEndpoint.add(WebUtil.getUrl(request)); //本地文件存储系统 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…