【发布时间】:2017-09-17 01:08:58
【问题描述】:
这是我在 Spring Boot 中的控制器
@RequestMapping(value = "/test", method = RequestMethod.POST, consumes = "multipart/form-data")
@ResponseBody
public ResponseEntity<?> test(
@RequestParam("enveloppe") Enveloppe enveloppe,
@RequestParam("files") MultipartFile[] uploadFiles) {
}
这是我在 angularJs 中的服务
var fd = new FormData();
angular.forEach(files, function(file) {
fd.append('files', file);
})
fd.append('enveloppe', enveloppe, {type :'application/xml'} );
$http.post("/test", fd, {
transformRequest : angular.identity,
headers : {
'Content-Type' : undefined
}
我的对象“信封”由 xsd 在 spring boot 中自动生成。 我在 angularjs 中的对象“enveloppe”由 json2Xml lib 转换为具有 xml。 但是,弹簧靴不能'包装对象信封。 ~
1) 可以这样做吗?
【问题讨论】:
-
此链接可能会有所帮助stackoverflow.com/questions/42671510/…
标签: java angularjs xml spring-boot multipartform-data