Skip to content

wangqisen/async-http-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"]

Features

  • Asynchronous
  • Minimum: just download webpages from Internet efficently.
  • Support SOCKS v5, HTTP proxy
  • HTTPS(trust all)
  • Configurable
  • DNS prefetch,

Limitations:

  • 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.

Example

  // 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

License

Copyright © 2012 Feng Shen. Distributed under the Apache License Version 2.0.

About

A fast async http client based on netty

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published