You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the HiddenHttpMethodFilter and MultipartFilter as described in their respective JavaDoc produces a stack trace with the message:
The current request is not a multipart request.
... when used with Spring MVC's DispatcherServlet.
To my understanding the HiddenHttpMethod wraps the HTTP Request and changes the POST method to PUT. This makes the method isMultipartRequest (lines 187-193) in RequestParamMethodArgumentResolver always return false:
An obvious fix would be to remove the if-clause and rely only on the HTTP content-type header. Another is to include the HTTP PUT method as a valid multipart HTTP method in the if-clause.
The Apache Commons FileUpload on which CommonsMultipartResolver is built, recognizes "POST" multipart requests only and so does the Servlet 3 based StandardMultipartResolver. So currently a true PUT request would not even be parsed.
It sounds like in your case the actual request is a POST converted to a PUT by the HiddenHttpMethodFilter, correct? We should drop the check of the HTTP method from RequestParamMethodArgumentResolver (and also from RequestPartMethodArgumentResolver). It should be sufficient to verify the content type starts with "multipart/" at that point.
Christoffer Soop opened SPR-9079 and commented
Using the
HiddenHttpMethodFilter
andMultipartFilter
as described in their respective JavaDoc produces a stack trace with the message:... when used with Spring MVC's DispatcherServlet.
To my understanding the HiddenHttpMethod wraps the HTTP Request and changes the POST method to PUT. This makes the method
isMultipartRequest
(lines 187-193) inRequestParamMethodArgumentResolver
always returnfalse
:An obvious fix would be to remove the if-clause and rely only on the HTTP content-type header. Another is to include the HTTP PUT method as a valid multipart HTTP method in the if-clause.
Affects: 3.1 GA
Attachments:
Referenced from: commits 64a69f7
The text was updated successfully, but these errors were encountered: