I am trying to upload a File with one parameter using spring 3.
This is my controller method which should enable this service:
@RequestMapping(value="/{id}", method = RequestMethod.PUT, headers="content-type=multipart/form-data")
public ResponseEntity<String> uploadImageWithJsonParamater(@PathVariable("id") Long id, @RequestParam String json, @RequestParam MultipartFile customerSignFile) {
//...
}
The problem is, that the server cannot dispatch to this method:
MissingServletRequestParameterException: Required String parameter 'json' is not present
If I change the RequestMethod from PUT to POST, everything is fine. So does anybody know the problem?
It seems that it isn't allowed to transmit form-data via PUT.
I debugged a little bit and the following method returns false in the PUT case but true in the POST case:
public boolean isMultipart(HttpServletRequest request) {
return (request != null && ServletFileUpload.isMultipartContent(request));
}
I would appreciate any help!
Thanks in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…