Vaadin-upload:使用vaadin上传上传csv文件时不支持415种媒体类型

时间:2017-10-03 07:55:07

标签: polymer vaadin iron-ajax

我使用Vaadin上传网络组件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>

我在标题中检查了multipart / form数据是否附加到标题中, 我已经从邮递员检查了我的服务器端代码,我能够通过邮递员将csv文件发送到服务器端,但是同样的情况不是从UI发生的。 Request header 任何人都可以帮助我,我无法理解?

服务器端代码是:

@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";
  }

0 个答案:

没有答案