An Async HTTP Client Based on Netty
I write this for my personal part time project RSSMiner, for the web crawler and feed fetcher module.
Please checkout out http-kit, it should have better performance.
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
<dependency>
<groupId>me.shenfeng</groupId>
<artifactId>async-http-client</artifactId>
<version>1.1.0</version>
</dependency>
; You may want to write an wrapper function to make it easier to use in Clojure project
[me.shenfeng/async-http-client "1.1.0"]
- Asynchronous
- Minimum: just download webpages from Internet efficently.
- Support SOCKS v5, HTTP proxy
- HTTPS(trust all)
- Configurable
- DNS prefetch,
- All Content are buffered in memory as byte array=> can not handle large file. Anyway, it's meant to download webpages(zipped if server support)
- Dns prefetch is IPV4 only.
// Http client sample usage
HttpClientConfig config = new HttpClientConfig();
header = new HashMap<String, Object>();
HttpClient client = new HttpClient(config);
URI uri = new URI("http://onycloud.com");
final HttpResponseFuture future = client.execGet(uri, header);
resp.addListener(new Runnable() {
public void run() {
HttpResponse resp = future.get(); // async
}
});
HttpResponse resp = future.get(); // blocking
Copyright © 2012 Feng Shen. Distributed under the Apache License Version 2.0.