|
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; |
@@ -483,6 +485,26 @@ public Rsp<List<FileRspDto>> batchUploadFile(HttpClassicServerRequest httpReques |
483 | 485 | return Rsp.ok(fileRspDtos); |
484 | 486 | } |
485 | 487 |
|
| 488 | + /** |
| 489 | + * 从远端下载文件或者从 nas 下载文件。 |
| 490 | + * |
| 491 | + * @param httpRequest 表示 Http 请求体的 {@link HttpClassicServerRequest}。 |
| 492 | + * @param tenantId 表示租户唯一标识的 {@link String}。 |
| 493 | + * @param fileCanonicalPath 表示文件的规范路径的 {@link String}。 |
| 494 | + * @param fileName 表示文件名的 {@link String}。 |
| 495 | + * @param httpClassicServerResponse 表示 Http 响应的 {@link HttpClassicServerResponse}。 |
| 496 | + * @return 表示文件实体的 {@link FileEntity}。 |
| 497 | + * @throws IOException 表示文件读写异常的 {@link IOException}。 |
| 498 | + */ |
| 499 | + @GetMapping(path = "/{tenant_id}/file", description = "下载文件") |
| 500 | + public FileEntity getFile(HttpClassicServerRequest httpRequest, @PathVariable("tenant_id") String tenantId, |
| 501 | + @RequestParam(value = "filePath", required = false) String fileCanonicalPath, |
| 502 | + @RequestParam(value = "fileName") String fileName, HttpClassicServerResponse httpClassicServerResponse) |
| 503 | + throws IOException { |
| 504 | + OperationContext context = new OperationContext(); |
| 505 | + return this.fileService.getFile(context, fileCanonicalPath, fileName, httpClassicServerResponse); |
| 506 | + } |
| 507 | + |
486 | 508 | /** |
487 | 509 | * 清空应用的历史对话。 |
488 | 510 | * |
|
0 commit comments