Datasets:
ArXiv:
License:
File size: 884 Bytes
c574d3a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import httpcli.HttpCall;
import httpcli.HttpCallback;
import httpcli.HttpCli;
import httpcli.HttpRequest;
import httpcli.ResponseBody;
public class SimpleAsync {
public static void main(String[] args) throws Exception {
HttpCli cli = HttpCli.get()
.setDebug(true);
HttpRequest request = new HttpRequest(
"GET", "http://127.0.0.1/test.php");
HttpCall<ResponseBody> call = cli.newCall(request);
call.execute(new HttpCallback<ResponseBody>() {
@Override
public void onResponse(ResponseBody result) throws Exception {
String str = result.as(String.class);
System.out.println(str);
}
@Override
public void onFailure(Exception e) {
e.printStackTrace();
}
});
}
}
|