Skip to content

Clarify use of "x-www-form-urlencoded" in reference documentation [SPR-8415] #13063

Closed

Description

@spring-projects-issues

Rossen Stoyanchev opened SPR-8415 and commented

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

Affects: 3.1 M1

Issue Links:

Activity

  1. spring-projects-issues commented on Jun 17, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Arjen Poutsma commented

    use of request.getParameter*() before the @RequestBody argument is resolved causes problems

    More specifically: doing request.getParameter() reads the entire request input stream, so there is nothing to convert from any more.

  2. spring-projects-issues commented on Jul 25, 2011

    @spring-projects-issues
    CollaboratorAuthor

    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 @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.

  3. spring-projects-issues commented on Feb 6, 2013

    @spring-projects-issues
    CollaboratorAuthor

    Arjan van B. commented

    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>>?

    (HttpPutFormContentFilter consumes 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.)

  4. spring-projects-issues commented on Feb 8, 2013

    @spring-projects-issues
    CollaboratorAuthor

    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.

  5. spring-projects-issues commented on Feb 10, 2013

    @spring-projects-issues
    CollaboratorAuthor

    Arjan van B. commented

    (Pull request for documentation submitted; #230)

  6. added
    in: web
    type: task
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: task

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions