1 Star 0 Fork 271

simon / forest

forked from 捣鼓 / forest 
Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
CALLBACK.md 867 Bytes
Copy Edit Web IDE Raw Blame History
骏码 authored 2017-04-21 18:58 . new repository

Forest 使用文档

回调方法

OnSuccess - 请求成功:


@Request(
    url = "http://dwz.cn/create.php",
    type = "post",
    dataType = "json"
)
String testOnSuccess(@DataParam("url") String url, OnSuccess<Map> onSuccess);

...

client.testOnSuccess("https://github.com/mySingleLive", new OnSuccess<Map>() {
    public void onSuccess(Map data, ForestRequest request, ForestResponse response) {
        System.out.println(data);
        assertNotNull(data);
        assertEquals(data.get("status"), 0);
    }
});

OnError - 请求失败:


@Request(url = "http://this_is_a_error_address", timeout = 10)
String testError(OnError onError);

...

client.testError(new OnError() {
    public void onError(ForestRuntimeException ex, ForestRequest request) {
        assertNotNull(ex);
        assertNotNull(request);
    }
});

Comment ( 0 )

Sign in for post a comment

Java
1
https://gitee.com/simon_kly/forest.git
git@gitee.com:simon_kly/forest.git
simon_kly
forest
forest
master

Search

101046 36f486cf 1899542 101055 4cb66026 1899542