Over the past week, I've been struggling to adapt a Grails application to use the REST architecture. Problem is, I've had nothing but trouble throughout.
For this application, the choice between using XML and JSON literally came down to a coin flip. Neither format offered much over the other, so I went with XML.
Writing the URL redirects and the controller methods was relatively easy and got me interested. The problems came when actually doing stuff with the new controller functions. Specifically, two major issues came to light
First, the list view of an object works with the regular CRUD method. Adapting to REST required executing a query to get all objects, count them up and render the output as both HTML and XML using the withFormat method.
HTML view shows absolutely nothing in the way of listings, but the XML tree shows up when I comment out the HTML section in withFormat. So I know that part's working.
Secondly, what to do when a premature end of XML file exception comes at you when its the machine creating the XML in the first place?
At this point, to me at least, REST seems like more of a solution in search of a problem. It essentially co-opts the HTTP functions for its own use, when controller redirects seem to work fine.
Is it a scalability adaptation?