-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issueA duplicate of another issue
Description
Stefan Ocke opened SPR-8040 and commented
When using HiddenHttpMethodFilter, like for example Spring Roo generated apps do, the ServletRequest is wrappd into a HttpMethodRequestWrapper (at least in cases, where wrapping is necessary, for example for PUT requests emulated with POST and httpMethod parameter).
Later, when it comes to data binding the ServletRequestDataBinder.bind method checks for multipart requests:
MutablePropertyValues mpvs = new ServletRequestParameterPropertyValues(request);
if (request instanceof MultipartRequest) {
MultipartRequest multipartRequest = (MultipartRequest) request;
bindMultipart(multipartRequest.getMultiFileMap(), mpvs);
}
doBind(mpvs);
But if the multipart request has been wrapped into a HttpMethodRequestWrapper , this won't work anymore, since it is not an instance of MultipartRequest. Thus, no databinding for the Multipart files occurs.
NOTE: My setup ist the following:
- I am using a MultipartFilter in front of the WebMethodFilter, as suggested in bold letters in the Javadoc of HiddenHttpMethodFilter
- I am using binding for the uploaded files, instead of "injecting" them as parameters in the controller mehtods. For this, I register an according converter / bean editor from MultipartFile to byte array
- For POST request, this setup works fine. For PUT (emulated by POST and httpMethod parameter), the problem described above arises.
Affects: 3.0.5
Issue Links:
- ServletRequestDataBinder does not bind MultipartFile with HiddenHttpMethodFilter and Multipart Request [SPR-7795] #12451 ServletRequestDataBinder does not bind MultipartFile with HiddenHttpMethodFilter and Multipart Request ("duplicates")
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issueA duplicate of another issue