Class FsHttpEndpoint
java.lang.Object
io.github.xezzon.zeroweb.storage.fs.FsHttpEndpoint
@RestController
@ConditionalOnBean(ZerowebFsConfig.class)
public class FsHttpEndpoint
extends Object
上传/下载附件到文件系统
- Author:
- xezzon
-
Constructor Summary
ConstructorsConstructorDescriptionFsHttpEndpoint(Optional<FsService> fsService, IAttachmentService attachmentService) 注入依赖 -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<byte @NonNull []> 下载文件void上传文件到服务器磁盘void上传文件分段到服务器磁盘
-
Constructor Details
-
FsHttpEndpoint
注入依赖- 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- 附件IDfileContent- 文件内容
-
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- 附件IDpartNumber- 分段序号fileContent- 文件内容
-
download
@GetMapping("/fs/{id}/download") public org.springframework.http.ResponseEntity<byte @NonNull []> download(@PathVariable @NotBlank @NotBlank String id) 下载文件- Parameters:
id- 附件ID- Returns:
- 文件内容
-