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 7601007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:03:49+00:00 2026-05-30T23:03:49+00:00

I am developing a restful webservice using grails for first time and I following

  • 0

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

  • 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-05-30T23:03:51+00:00Added an answer on May 30, 2026 at 11:03 pm

    I’m not sure what exactly you are trying to do since I don’t know what your localhost service is supposed to return. Since you’re looking for books, here’s an example using Google’s book search that may be of help. I wrote so that you can run in the Groovy console if you want, but will work in grails as well.

    @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.2' )
    
    import groovyx.net.http.HTTPBuilder
    import static groovyx.net.http.ContentType.JSON
    import static groovyx.net.http.Method.GET
    
    def http = new HTTPBuilder("https://www.googleapis.com")
    
    http.handler.failure = { resp, json ->
        println "it broke ${resp} ${json}"
    }
    http.get(path: '/books/v1/volumes', query:[q:'quilting']) { resp, json ->
        if (resp.status == 200) {
            json?.items.each {book ->
                println "${book?.volumeInfo?.title}"
            }
        } else {
            return [error:"Did not return a proper response: ${resp.status}"]
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently developing a RESTful Webservice in Java using the Jersey library. For
Really simple question. I trying to test a Restful webservice that I am developing,
I'm developing a new RESTful webservice for our application. When doing a GET on
I'm developing a simple RESTful API, and utterly in love with how minimalistic it
I'm using the RESTful authentication Rails plugin for an app I'm developing. I'm having
So, I'm developing a REST webservice using RESTeasy and Google App Engine. My question
I am developing RESTful API for my application. All getters (that use HTTP GET)
I am developing a RESTful web service using JAX-RS. I am using JAXB to
I'm developing a RESTful API and have a question about the most appropriate response
I'm developing a RESTful webservice in Java. For Integrationtesting I use a separate project,

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.