0
我創建一個休息控制器,它看起來像這樣的文件格式,數據請求:處理multipart /在了Spring Web 4
@RequestMapping(value = "/clients", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> createClientRecord(
@RequestPart(value = "imageFile") MultipartFile imageFile,
@RequestPart(value = "field1") String field1,
@RequestPart(value = "field2") String field2) {... }
我試圖通過設置身體類型是發送從郵差的請求「表單數據」 的郵差UI:
,但我有此錯誤:
Status 500 accessing url: '/api/v1/clients' -> UT000072: Failed to decode url ... ... (some unreadable characters) to charset UTF-8
我的問題是:我應該怎麼做,以處理多個表單數據與Spring Web 4中的文件的http post請求?而不是使用
通過將註釋從RequestPart更改爲RequestParam並取出POST請求註釋中的'comsumes'值來解決此問題。還重新創建數據庫表,不確定這是相關的... –