I want to publish a text file from my desktop using the Advanced Rest Client. This is my controller:
@RequestMapping(value = "/vsp/debug/compareConfig/{deviceIp:.*}", method = RequestMethod.POST, consumes = { "multipart/form-data" }, produces = { "application/json" })
public ResponseEntity<SuccessResult> compareCLIs(HttpServletRequest request, @RequestParam("file") MultipartFile file, @PathVariable("deviceIp") String device)
{
log.info(file.getOriginalFilename());
byte[] bytearr = file.getBytes();
log.info("byte length: ", bytearr.length);
log.info("Size : ", file.getSize());
}
This does not return a value for byte length or file size. I want to read the values of a file in a StringBuffer. Can anyone point out pointers to this? I'm not sure if I need to save this file before parsing it in a line. If so, how to save the file in the workspace?
source
share