Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

REST is not a solution, it's a convention, and as such, it is subjective.

Which is more readable?

REST:

PUT /users/profile/1234
{userName:fooBar,...}

Non REST:

POST /userController.go?action=updateUser&userId=1234&userName=fooBar...

It's up to you to decide what you prefer

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.