Class FsHttpEndpoint

java.lang.Object
io.github.xezzon.zeroweb.storage.fs.FsHttpEndpoint

@RestController @ConditionalOnBean(ZerowebFsConfig.class) public class FsHttpEndpoint extends Object
上传/下载附件到文件系统
Author:
xezzon
  • Constructor Details

    • FsHttpEndpoint

      public FsHttpEndpoint(Optional<FsService> fsService, IAttachmentService attachmentService)
      注入依赖
      Parameters:
      fsService - 文件系统存储服务
      attachmentService - 附件服务
  • Method Details

    • upload

      @PutMapping("/fs/{id}/upload") public void upload(@PathVariable @NotBlank @NotBlank String id, @RequestBody @NotEmpty @NotEmpty byte[] fileContent)
      上传文件到服务器磁盘
      Parameters:
      id - 附件ID
      fileContent - 文件内容
    • upload

      @PutMapping("/fs/{id}/upload/{partNumber}") public void upload(@PathVariable @NotBlank @NotBlank String id, @PathVariable @Positive @Max(10000L) @Positive @Max(10000L) int partNumber, @RequestBody @NotEmpty @NotEmpty byte[] fileContent)
      上传文件分段到服务器磁盘
      Parameters:
      id - 附件ID
      partNumber - 分段序号
      fileContent - 文件内容
    • download

      @GetMapping("/fs/{id}/download") public org.springframework.http.ResponseEntity<byte @NonNull []> download(@PathVariable @NotBlank @NotBlank String id)
      下载文件
      Parameters:
      id - 附件ID
      Returns:
      文件内容