|
17 | 17 | import modelengine.fit.http.annotation.RequestBody; |
18 | 18 | import modelengine.fit.http.annotation.RequestMapping; |
19 | 19 | import modelengine.fit.http.annotation.RequestParam; |
| 20 | +import modelengine.fit.http.entity.FileEntity; |
20 | 21 | import modelengine.fit.http.entity.PartitionedEntity; |
21 | 22 | import modelengine.fit.http.server.HttpClassicServerRequest; |
| 23 | +import modelengine.fit.http.server.HttpClassicServerResponse; |
22 | 24 | import modelengine.fit.jane.common.controller.AbstractController; |
23 | 25 | import modelengine.fit.jane.common.entity.OperationContext; |
24 | 26 | import modelengine.fit.jane.common.response.Rsp; |
@@ -502,6 +504,26 @@ public Rsp<List<FileRspDto>> batchUploadFile(HttpClassicServerRequest httpReques |
502 | 504 | return Rsp.ok(fileRspDtos); |
503 | 505 | } |
504 | 506 |
|
| 507 | + /** |
| 508 | + * 从远端下载文件或者从 nas 下载文件。 |
| 509 | + * |
| 510 | + * @param httpRequest 表示 Http 请求体的 {@link HttpClassicServerRequest}。 |
| 511 | + * @param tenantId 表示租户唯一标识的 {@link String}。 |
| 512 | + * @param fileCanonicalPath 表示文件的规范路径的 {@link String}。 |
| 513 | + * @param fileName 表示文件名的 {@link String}。 |
| 514 | + * @param httpClassicServerResponse 表示 Http 响应的 {@link HttpClassicServerResponse}。 |
| 515 | + * @return 表示文件实体的 {@link FileEntity}。 |
| 516 | + * @throws IOException 表示文件读写异常的 {@link IOException}。 |
| 517 | + */ |
| 518 | + @GetMapping(path = "/{tenant_id}/file", description = "下载文件") |
| 519 | + public FileEntity getFile(HttpClassicServerRequest httpRequest, @PathVariable("tenant_id") String tenantId, |
| 520 | + @RequestParam(value = "filePath", required = false) String fileCanonicalPath, |
| 521 | + @RequestParam(value = "fileName") String fileName, HttpClassicServerResponse httpClassicServerResponse) |
| 522 | + throws IOException { |
| 523 | + OperationContext context = new OperationContext(); |
| 524 | + return this.fileService.getFile(context, fileCanonicalPath, fileName, httpClassicServerResponse); |
| 525 | + } |
| 526 | + |
505 | 527 | /** |
506 | 528 | * 清空应用的历史对话。 |
507 | 529 | * |
|
0 commit comments