-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Paul Sideleau opened SPR-7795 and commented
I have setup a MultipartFilter and HtmlHiddenMethodFilter following the instructions in #11260 and the javadoc.
I have a java bean that has a org.springframework.web.multipart.MultipartFile property. I attempt to bind my bean with the standard @ModelAttribute annotation. The rest of its properties get resolved correctly but the MultipartFile property is set to null.
I believe the issue is that on line 106 of the ServletRequestDataBinder it does an instanceof check: "request instanceof MultipartRequest" which will return false because its the HttpMethodRequestWrapper class from the HtmlHiddenMethodFilter.
However, if I move the property out of my javabean and bind it via a RequestParam annoation, it works correctly.
public ModelAndView uploadFile(@RequestParam("file") MultipartFile file) {
// code
}
Affects: 3.0.4
Issue Links:
- ServletRequestDataBinder.bind should also consider wrapped ServletRequests when checking for Multipart, to comply with HiddenHttpMethodFilter. [SPR-8040] #12695 ServletRequestDataBinder.bind should also consider wrapped ServletRequests when checking for Multipart, to comply with HiddenHttpMethodFilter. ("is duplicated by")
- HiddenHttpMethodFilter does not support multipart requests [SPR-6594] #11260 HiddenHttpMethodFilter does not support multipart requests
Referenced from: commits b3f039a
1 votes, 2 watchers