Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RestController
- @RequestMapping("node-info")
- class NodeInfoController(val nodeInfoService: NodeInfoService) {
- @PostMapping
- @ResponseStatus(HttpStatus.CREATED)
- fun saveNodeInfo(@RequestParam("file") file: MultipartFile) = nodeInfoService.saveNodeInfo(file)
- ....
- }
- override fun saveNodeInfo(file: MultipartFile) {
- val configWrapper = file.bytes.deserialize<SignedNodeInfo>()
- val name = configWrapper.raw.deserialize().legalIdentities.first().name
- ...
- }
- override fun registerNodeInfo(nodeInfoFile: File): Mono<NodeInfoContainer> {
- val multipartBodyBuilder = MultipartBodyBuilder().apply {
- part("file", object : ByteArrayResource(nodeInfoFile.readBytes()){
- override fun getFilename(): String {
- return nodeInfoFile.name
- }
- })
- }
- return webClient.post()
- .uri("/node-info")
- .syncBody(multipartBodyBuilder.build())
- .retrieve()
- .bodyToMono()
- }
- override fun saveNodeInfo(file: MultipartFile, token : String ){
- ...
- }
Add Comment
Please, Sign In to add comment