I am new to Helidon MP and would like to know if there is a way to upload files to Oracle DB (Blob/Clob Column) via REST service created using Helidon MP.
I am able to acheive the same requirement in SpringBoot using below code accepting the file parameter as MultiPart, how can we acheive this using Helidon MP
@PostMapping("/upload")
public ResponseEntity<ResponseMessage> uploadFile(@RequestParam("file") MultipartFile file) {
String message = "";
try {
storageService.store(file);
message = "Uploaded the file successfully: " + file.getOriginalFilename();
return ResponseEntity.status(HttpStatus.OK).body(new ResponseMessage(message));
} catch (Exception e) {
message = "Could not upload the file: " + file.getOriginalFilename() + "!";
return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body(new ResponseMessage(message));
}
}
Helidon offers support for multi-part data through both MP and SE (with buffered and streamed API version for SE) flavors.
The implementation relies on Jersey Integration with MIME MultiPart messages (would be quite similar to any JAX-RS provider).
An implementation of a controller endpoint method allowing to upload files is straightforward and looks like below:
Note that the JAX-RS multi-part feature is not activated by default, hence should be activated using JAX-RS providers: