我正在使用 Vaadin 上传 Web 组件https://vaadin.com/elements/vaadin-upload在使用 vaadin 上传上传 csv 文件后从前端上传 CSV 文件我收到 500 内部服务器错误 vaadin 上传组件是
<vaadin-upload id="calibration"
target="/imdex/idp/api/v1/upload"
method="POST"
timeout=15000
on-upload-start="uploadStarted" >
<iron-icon slot="drop-label-icon" icon="description"></iron-icon>
<span slot="drop-label">Drop your calibration file</span>
</vaadin-upload>
我检查了标题多部分/表单数据被附加到标题中,我已经检查了邮递员的服务器端代码,我能够通过邮递员将 csv 文件发送到服务器端,但 UI 中没有发生同样的情况。 谁能帮助我我无法弄清楚?
服务器端代码是:
@RestController
@RequestMapping("imdex/idp/api/v1")
public class BlobstoreController {
@Autowired
BlobstoreService objectStoreService;
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public @ResponseBody String singleSave(@RequestParam("file") MultipartFile
file) throws Exception {
System.out.println("in upload");
if (file != null) {
S3Object obj = new S3Object();
try {
obj.setKey(file.getOriginalFilename());
obj.setObjectContent(file.getInputStream());
objectStoreService.put(obj);
} catch (Exception e) {
throw e;
} finally {
obj.close();
}
}
return "uploaded successfully";
}