https://github.com/grails/grails-http
Grails HTTP Utility Classes
https://github.com/grails/grails-http
Last synced: about 1 year ago
JSON representation
Grails HTTP Utility Classes
- Host: GitHub
- URL: https://github.com/grails/grails-http
- Owner: grails
- License: apache-2.0
- Archived: true
- Created: 2016-03-23T13:57:40.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-30T13:28:34.000Z (about 10 years ago)
- Last Synced: 2025-04-20T15:24:10.159Z (about 1 year ago)
- Language: Groovy
- Size: 350 KB
- Stars: 7
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Grails HTTP Utilities
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.
* [](https://travis-ci.org/grails/grails-http)
## Example
```groovy
import grails.http.client.*
import grails.async.*
AsyncHttpBuilder client = new AsyncHttpBuilder()
Promise p = client.post("https://localhost:8080/foo/bar") {
contentType 'application/json'
json {
title "Ping"
}
}
p.onComplete { HttpClientResponse resp ->
assert resp.json.title == 'Pong'
}
```
## Installation
To use the `AsyncHttpBuilder` class outside of Grails use the dependency directly:
```groovy
compile "org.grails:http-client:VERSION"
```
Where `VERSION` is the version you wish to use. For usage within Grails there is a plugin:
```groovy
compile "org.grails.plugins:async-http-builder:VERSION"
```
For more information see the documentation:
* [Snapshot Documentation](http://grails.github.io/grails-http/snapshot/)