I am developing a restful webservice using grails for first time and I following the chapter 13 in the grails documentation for setting up a simple response to a GET request.
The thing i do not get is setting up HTTPBuilder for creating a client which makes a get request. I have downloaded the jar httpbuilder, The Restful client is defined as follows
import groovyx.net.http.*
import static groovyx.net.http.ContentType.JSON
def http = new HTTPBuilder("http://localhost:8080/amazon")
http.request(Method.GET, JSON) { url.path = '/book/list' response.success = { resp, json -> for (book in json.books) { println book.title } } }
So the code they have customized for the client is it a new HTTPBuilder class defined ? if yes where do we need to define this class
Right now the routing of URL to show def in my controller is not happeining.
Thanks