Grails
  1. Grails
  2. GRAILS-9888 REST and URL mapping changes
  3. GRAILS-7423

Grails controller should not try to parse empty request bodies for GET, HEAD, DELETE, PUT or POST

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.7
    • Fix Version/s: 2.3-RC1
    • Component/s: Ajax
    • Labels:
      None
    • Environment:
      MacOSX 10.6.7
      JDK 1.6.0_24

      Description

      When I send a GET request with an empty body to my grails 1.3.7
      controller by using the .json file extension (eg
      http://localhost:8080/myapp/mycontroller/myaction.json) I get a
      request parsing exception and it seems that grails is trying to parse
      my empty body to JSON. If I send the same request to the same action
      but without the .json extension, I don't have any error.

      It would make sense not to try to parse the request body for GET, HEAD and DELETE.
      The same should apply to empty request bodies for PUT and POST, although it won't happen that often.

        Issue Links

          Activity

          Hide
          Bobby Warner added a comment -

          I'm unable to replicate this issue with Grails 2.2. I do not receive any exceptions accessing actions via GET with .json extensions and empty body, but rather is just executes the action. Can you please validate this is no longer an issue in newer versions of Grails? Please let me know.

          Show
          Bobby Warner added a comment - I'm unable to replicate this issue with Grails 2.2. I do not receive any exceptions accessing actions via GET with .json extensions and empty body, but rather is just executes the action. Can you please validate this is no longer an issue in newer versions of Grails? Please let me know.
          Hide
          Graeme Rocher added a comment -

          I have converted it to a subtask of GRAILS-9888 to verify that it works as expected along with the REST improvements in 2.3

          Show
          Graeme Rocher added a comment - I have converted it to a subtask of GRAILS-9888 to verify that it works as expected along with the REST improvements in 2.3
          Hide
          Graeme Rocher added a comment -

          As part of the data binding, with the new BindingSource concept the binding source should only be created for PUT, POST and PATCH http methods.

          Also need to take into account with UrlMappingInfo.parseRequest is set to true (otherwise no BindingSource should be created from JSON/XML packets)

          Show
          Graeme Rocher added a comment - As part of the data binding, with the new BindingSource concept the binding source should only be created for PUT, POST and PATCH http methods. Also need to take into account with UrlMappingInfo.parseRequest is set to true (otherwise no BindingSource should be created from JSON/XML packets)
          Hide
          Graeme Rocher added a comment -

          After having discussed this with Jeff I believe most everything can be done lazily and hence the parseRequest parameter can be made redundant. Jeff is working on this.

          Show
          Graeme Rocher added a comment - After having discussed this with Jeff I believe most everything can be done lazily and hence the parseRequest parameter can be made redundant. Jeff is working on this.
          Hide
          Graeme Rocher added a comment -

          I believe this is fixed with the removal of the parameter creation listener mechanism

          Show
          Graeme Rocher added a comment - I believe this is fixed with the removal of the parameter creation listener mechanism
          Hide
          Jeff Scott Brown added a comment -

          Agreed

          Show
          Jeff Scott Brown added a comment - Agreed

            People

            • Assignee:
              Jeff Scott Brown
              Reporter:
              Sébastien Arbogast
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Last Reviewed:

                Development