@@ -15,19 +15,19 @@ Latest `version`: [![Maven][mavenImg]][mavenLink]
15
15
16
16
## Installation
17
17
18
- First, in order to add it to your Maven project, simply add this dependency:
18
+ First, in order to add it to your Maven project, simply add this dependency -- see [ mvnrepository ] ( http://mvnrepository.com/artifact/org.asynchttpclient/async-http-client ) for latest version :
19
19
20
20
``` xml
21
21
<dependency >
22
- <groupId >com.ning </groupId >
23
- <artifactId >async-http-client</artifactId >
24
- <version >version </version >
22
+ <groupId >org.asynchttpclient </groupId >
23
+ <artifactId >async-http-client</artifactId >
24
+ <version >2.0.0-RC12 </version >
25
25
</dependency >
26
26
```
27
27
28
28
You can also download the artifact
29
29
30
- [ Maven Search] ( http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.ning%22%20AND%20a%3A%22async -http-client%22 )
30
+ [ Maven Search] ( http://mvnrepository.com/artifact/org.asynchttpclient/async -http-client )
31
31
32
32
AHC is an abstraction layer that can work on top of the bare JDK, Netty and Grizzly.
33
33
Note that the JDK implementation is very limited and you should ** REALLY** use the other * real* providers.
@@ -66,11 +66,11 @@ Check [migration guide](MIGRATION.md) for migrating from 1.8 to 1.9.
66
66
Then in your code you can simply do
67
67
68
68
``` java
69
- import com.ning.http.client .* ;
69
+ import org.asynchttpclient .* ;
70
70
import java.util.concurrent.Future ;
71
71
72
72
AsyncHttpClient asyncHttpClient = new AsyncHttpClient ();
73
- Future<Response > f = asyncHttpClient. prepareGet(" http://www.ning .com/" ). execute();
73
+ Future<Response > f = asyncHttpClient. prepareGet(" http://www.example .com/" ). execute();
74
74
Response r = f. get();
75
75
```
76
76
@@ -79,11 +79,11 @@ Note that in this case all the content must be read fully in memory, even if you
79
79
You can also accomplish asynchronous (non-blocking) operation without using a Future if you want to receive and process the response in your handler:
80
80
81
81
``` java
82
- import com.ning.http.client .* ;
82
+ import org.asynchttpclient .* ;
83
83
import java.util.concurrent.Future ;
84
84
85
85
AsyncHttpClient asyncHttpClient = new AsyncHttpClient ();
86
- asyncHttpClient. prepareGet(" http://www.ning .com/" ). execute(new AsyncCompletionHandler<Response > (){
86
+ asyncHttpClient. prepareGet(" http://www.example .com/" ). execute(new AsyncCompletionHandler<Response > (){
87
87
88
88
@Override
89
89
public Response onCompleted (Response response ) throws Exception {
@@ -104,11 +104,11 @@ asyncHttpClient.prepareGet("http://www.ning.com/").execute(new AsyncCompletionHa
104
104
You can also mix Future with AsyncHandler to only retrieve part of the asynchronous response
105
105
106
106
``` java
107
- import com.ning.http.client .* ;
107
+ import org.asynchttpclient .* ;
108
108
import java.util.concurrent.Future ;
109
109
110
110
AsyncHttpClient asyncHttpClient = new AsyncHttpClient ();
111
- Future<Integer > f = asyncHttpClient. prepareGet(" http://www.ning .com/" ). execute(
111
+ Future<Integer > f = asyncHttpClient. prepareGet(" http://www.example .com/" ). execute(
112
112
new AsyncCompletionHandler<Integer > (){
113
113
114
114
@Override
@@ -131,11 +131,11 @@ which is something you want to do for large responses: this way you can process
131
131
You have full control on the Response life cycle, so you can decide at any moment to stop processing what the server is sending back:
132
132
133
133
``` java
134
- import com.ning.http.client .* ;
134
+ import org.asynchttpclient .* ;
135
135
import java.util.concurrent.Future ;
136
136
137
137
AsyncHttpClient c = new AsyncHttpClient ();
138
- Future<String > f = c. prepareGet(" http://www.ning .com/" ). execute(new AsyncHandler<String > () {
138
+ Future<String > f = c. prepareGet(" http://www.example .com/" ). execute(new AsyncHandler<String > () {
139
139
private ByteArrayOutputStream bytes = new ByteArrayOutputStream ();
140
140
141
141
@Override
0 commit comments