Name: grails-http
Owner: grails
Description: Grails HTTP Utility Classes
Created: 2016-03-23 13:57:40.0
Updated: 2017-08-22 04:52:00.0
Pushed: 2016-03-30 13:28:34.0
Homepage: null
Size: 358
Language: Groovy
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This project contains HTTP utility classes generally useful across both client and server projects.
Initially there is an Asynchronous HTTP client available that is built on Netty and designed as replacement for the synchronous RestBuilder project for Grails.
The client is however usable outside of Grails and for any general purpose.
import grails.http.client.*
import grails.async.*
AsyncHttpBuilder client = new AsyncHttpBuilder()
Promise<HttpClientResponse> p = client.post("https://localhost:8080/foo/bar") {
contentType 'application/json'
json {
title "Ping"
}
}
p.onComplete { HttpClientResponse resp ->
assert resp.json.title == 'Pong'
}
To use the AsyncHttpBuilder
class outside of Grails use the dependency directly:
compile "org.grails:http-client:VERSION"
Where VERSION
is the version you wish to use. For usage within Grails there is a plugin:
compile "org.grails.plugins:async-http-builder:VERSION"
For more information see the documentation: