Questions tagged [httpbuilder]

HTTPBuilder is a wrapper for Apache's HttpClient, with some (actually, a lot of) Groovy syntactical sugar thrown on top. The request/response model is also inspired by Prototype.js' Ajax.Request.

HTTPBuilder wraps Apache's HttpClient, with Groovy syntactical sugar thrown on top.

It handles common tasks such as building and parsing common content-types, handling common content-encodings, and built-in support for common authentication mechanisms. It works equally as well for simple REST-based requests, or ad-hoc web downloads.

The request/response model is inspired by Prototype.js's Ajax.Request.

206 questions
2
votes
3 answers

Get Plain HTML from HTTP Requests

I'm working on a grails app and for several hours already have been trying to get html code from a request. What I want to do is to get plain html (like in a webPage source, with all tags and stuff), so that i can work on that. I have already…
dulcyn
  • 65
  • 1
  • 3
  • 9
2
votes
1 answer

Groovy's HTTPBuilder for Java?

Is there an equivalent of Groovy's HTTPBuilder for Java?
TERACytE
  • 7,553
  • 13
  • 75
  • 111
1
vote
1 answer

groovy HTTP Builder not returning results

I have the following code in groovy HTTPBuilder http = new HTTPBuilder("https://ronna-afghan.harmonieweb.org/_layouts/searchrss.aspx") http.request(Method.GET, groovyx.net.http.ContentType.XML) { // set username and password…
allthenutsandbolts
  • 1,513
  • 1
  • 13
  • 34
1
vote
1 answer

Why can't I wrap withRest() with my own method and run a closure within it?

The HTTPBuilder plugin for Griffon is great and it simplifies my server calls quite well. The only problem, however, is that I don't want to have to keep repeating the same setup code all over the place. What I want to do is wrap a set of server…
cdeszaq
  • 30,869
  • 25
  • 117
  • 173
1
vote
3 answers

Groovy HTTPBuilder and Jackson

Can I use Jackson instead of JSON-lib with Groovy's HTTPBuilder when setting the body on request? Example: client.request(method){ uri.path = path requestContentType = JSON body = customer response.success = {…
Todd M
  • 1,012
  • 1
  • 15
  • 25
1
vote
1 answer

HTTPBuilder get method with closure parameter return MissingMethodException

below code: def http = new HTTPBuilder( 'http://twitter.com/statuses/' ) http.get( path: 'user_timeline.json', query: [id:'httpbuilder', count:5] ) { resp, json -> println resp.status json.each { // iterate over JSON 'status' object…
Xilang
  • 1,513
  • 3
  • 18
  • 36
1
vote
1 answer

Groovy. How can I get json elements in array

there is such a JSON: https://restcountries.com/v3.1/all I just want to have a choice "translations" -> "ita" -> "common" HTTPBuilder getHttpBuilder() { new HTTPBuilder('https://restcountries.com/') } def http = httpBuilder.request(Method.GET,…
TheShestov
  • 11
  • 4
1
vote
1 answer

HTTPBuilder adds valuecount,strings, bytes into request body and the other side can't parse that JSON

I need to send request with groovy HTTPBuilder, here is code: String authToken = "token" def cfManager = ComponentAccessor.getCustomFieldManager() def addressJira = "http://xxx" def http = new HTTPBuilder("${address}") …
Duxa
  • 55
  • 1
  • 7
1
vote
0 answers

RestClient.post response generating "error groovyx.net.http.ResponseParseException : OK"

I' am using groovy to consume a POST Rest api : here is my code : import groovyx.net.http.RESTClient @Grab (group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.7.1') def url =…
MAryem
  • 182
  • 1
  • 2
  • 14
1
vote
1 answer

Httpbuilder put examples for sending multiple query params groovy

I am using Httpbuilder 0.7.1 and groovy 1.8 to invoke the rest call. I need to send the mutiple values for the same query parameter but it is not working. I need to send values as below https:///?action=test&group=grp1&group=grp2 I have tried with…
kanskr
  • 43
  • 1
  • 5
1
vote
0 answers

Groovy RestClient POST request sends invalid JSON

I found, that sending JSON, which has entry which starts with "function" produces invalid JSON. Example: @Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.7.1') import groovy.json.JsonSlurper import groovy.json.JsonOutput import…
Slavik
  • 1,488
  • 1
  • 15
  • 24
1
vote
2 answers

how to extract response as json from http ng-builder

The URI myresourceUrl when hit in browser shows the json content in browser. Requirement: Need to use the get method of httpbuilder-ng to call GET of URI and response should have the content as json. This json file will be necessary as input for…
IKnowNothing
  • 21
  • 1
  • 2
1
vote
1 answer

Grails - Get return from my POST request HTTP

I have a grails code for a POST type REST call where I pass the login parameters and it was to receive the token and an access route, it is correct, both by Postman that I get these parameters right, and by the code also after all, it does not fall…
Marcius Leandro
  • 775
  • 1
  • 11
  • 34
1
vote
1 answer

Options method with body on SoapUI (Test)

I've looking for how is possible call an OPTIONS method with body parameters using groovy on SoapUI. I read this is possible but, incredible or not, i haven't found an example. I tried this: import groovyx.net.http.HTTPBuilder; public class…
Roldan
  • 39
  • 5
1
vote
1 answer

httpBuilder JSON response parse includes [ ]

This may be very obvious so please be gentle. The following code: def http = new HTTPBuilder(uri) http.request(POST,JSON ) { req -> headers.'Content-Type' = 'application/json' headers.'x-chkp-sid' = CHKPsid body = [ "limit"…
Mondo
  • 163
  • 13