Using RESTClient for Groovy - http://groovy.codehaus.org/modules/http-builder/doc/rest.html
Example code:
package restclient
import groovyx.net.http.RESTClient
import static groovyx.net.http.ContentType.JSON
restClient = new RESTClient( 'http://localhost:8080/CustomerDB/webresources/', JSON)
def resp = restClient.get(path: 'entities.customer')
assert resp.status == 200
println resp.data
def respHeaders = resp.getAllHeaders()
respHeaders.each { header ->
println header
}
Example code:
package restclient
import groovyx.net.http.RESTClient
import static groovyx.net.http.ContentType.JSON
restClient = new RESTClient( 'http://localhost:8080/CustomerDB/webresources/', JSON)
def resp = restClient.get(path: 'entities.customer')
assert resp.status == 200
println resp.data
def respHeaders = resp.getAllHeaders()
respHeaders.each { header ->
println header
}
No comments:
Post a Comment