Monday, June 4, 2012

Accessing Request Parameters in a Grails Domain Class

It's not exactly elegant to work with request parameters in a domain class but it was necessary. I have a bunch of domain classes with "asMap" methods where they render themself into a map and cascade to other domain objects as needed. In the controller, the resulting map is given to the renderer and we get a nice json response.

So now I've changed some fields and in order to stay backwards compatible, I created a new apiKey (a parameter needed for all calls to my app) that distinguishes old and new clients.

And now, without further ado, the code:

Loading ....

And that's that. Once all clients work with the new format/apiKey the offending code above will be removed, promised!

No comments:

Post a Comment