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
{{ message }}
Repository navigation
Clarify use of "x-www-form-urlencoded" in reference documentation [SPR-8415] #13063
For "x-www-form-urlencoded" data one could use an @RequestBody (via FormHttpMessageConverter) or a @ModelAttribute method argument (via data binding). The latter has a few advantages:
it results in a typed object rather than MultiValueMap
with MultiValueMap you lose the ability to apply automatic validation
use of request.getParameter*() before the @RequestBody argument is resolved causes problems
A section has been added to the reference documentation on working with 'application/x-www-form-urlencoded' data recommending the use of @ModelAttribute for browser and for non-browser requests. The case of HTTP PUT requests where the ServletRequest prevents access to form data through the requestParameter*() family of ServletRequest methods is specifically covered as well (see #10299).
The sections on working with @ModelAttribute have also been updated.
Would it make sense to add a note about NOT using HttpPutFormContentFilter in an application that also uses @RequestBody MultiValueMap<String, String> and/or HttpEntity<MultiValueMap<String, String>>?
Activity
spring-projects-issues commentedon Jun 17, 2011
Arjen Poutsma commented
More specifically: doing request.getParameter() reads the entire request input stream, so there is nothing to convert from any more.
spring-projects-issues commentedon Jul 25, 2011
Rossen Stoyanchev commented
A section has been added to the reference documentation on working with 'application/x-www-form-urlencoded' data recommending the use of
@ModelAttributefor browser and for non-browser requests. The case of HTTP PUT requests where the ServletRequest prevents access to form data through the requestParameter*() family of ServletRequest methods is specifically covered as well (see #10299).The sections on working with
@ModelAttributehave also been updated.spring-projects-issues commentedon Feb 6, 2013
Arjan van B. commented
Would it make sense to add a note about NOT using
HttpPutFormContentFilterin an application that also uses@RequestBody MultiValueMap<String, String>and/orHttpEntity<MultiValueMap<String, String>>?(
HttpPutFormContentFilterconsumes the request's input stream, making the other methods fail. That is: if I am right in my comment at SPR-5628. Documentation is at Working with "application/x-www-form-urlencoded" data.)spring-projects-issues commentedon Feb 8, 2013
Rossen Stoyanchev commented
Yes, that makes sense. It would be very helpful if you submitted a pull request. You can do it directly in Github by using the Edit button.
spring-projects-issues commentedon Feb 10, 2013
Arjan van B. commented
(Pull request for documentation submitted; #230)