【发布时间】:2018-09-17 20:49:40
【问题描述】:
尝试使用 rpc 客户端从 corda 节点下载附件:
@GetMapping("/download/{hash}")
fun download(@PathVariable("hash") hash : String) : ResponseEntity<Any> {
return try {
val input = SecureHash.parse(hash)
val file = ZipInputStream(rpc.proxy.openAttachment(input))
ResponseEntity.status(HttpStatus.OK).body(file)
}catch (e: Exception) {
ResponseEntity.status(HttpStatus.BAD_REQUEST).body(e.message)
}
}
上面代码的输出是:
{
nextEntry: {
name: "11.c",
crc: 2689263033,
size: 675,
method: 8,
extra: "VVQJAAN22XNb2EuCW3V4CwABBOgDAAAE6AMAAA==",
comment: null,
time: 1534318966000,
lastAccessTime: { },
creationTime: null,
compressedSize: 332,
directory: false,
lastModifiedTime: { }
}
}
但是我找不到任何下载的zip,如果是下载的我不知道在哪个目录下,zip里面有一个pdf文件我想下载到本地并打开它。
【问题讨论】:
-
我不知道为什么,但是这种方法对我不起作用。
标签: kotlin attachment corda