Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9226055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:44:09+00:00 2026-06-18T04:44:09+00:00

I am writing a controller capable of handeling different types of post requests. As

  • 0

I am writing a controller capable of handeling different types of post requests.

As a result I would like to be able to get the number of key value pairs in the request, then retrive them as some form of object (a list or some kind of iterator) so that I can loop through them retrieve their key and values and handle them appropriately.

Something like as follows:

def sz = request.size  // may or may not be necessary, but would still like to know how
def keyValPairs = request.listOfPosts
for (def keyVal : keyValPairs) {
    def key = keyVal.getKey();
    def val = keyVal.getVal();
    doSomething(key, val);
}

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:44:10+00:00Added an answer on June 18, 2026 at 4:44 am

    Several things to mention here. First of all, it all depends on the encoding of the POST data. For example, if you send the data in JSON format, converting it to a map is different than if you send it as Content-Type: application/x-www-form-urlencoded (that is the case if you send the data from a HTML form).

    If the latter is true, the only thing you need to do is to use getParameterMap() from plain old ServletRequest. Grails only overrides this method to provide a data structure that plays nicely with routing, namely GrailsParameterMap.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a front-controller that will handle page requests, by parsing $_SERVER['REQUEST_URI']. I would
I am using Gralis 1.3.7. I am writing a controller that needs to get
I'm writing a static page controller. I get the menuname in the routes.rb and
How would I go about writing an async controller action that is made up
I am writing a unit test for a WebApi controller that reads a POST
I am writing a wizard-like controller that handles the management of a single bean
I am writing a Controller for Codeigniter with a method named print. The name
I am writing a controller class for my plist, which gets called from another
I am writing a view controller for adding a new item to my app.
I am writing a unit test and the controller method is throwing an exception

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.