use of com.shizhefei.mvc.http.okhttp.GetMethod in project MVCHelper by LuckyJayce.
the class BooksOkHttp_SyncDataSource method loadBooks.
private List<Book> loadBooks(final int page) throws Exception {
GetMethod method = new GetMethod("https://www.baidu.com");
method.addHeader("a", "aaaaa");
method.addParam("api_key", "75ee6c644cad38dc8e53d3598c8e6b6c");
List<Book> data = method.executeSync(new ResponseParser<List<Book>>() {
@Override
public List<Book> parse(Response response) throws Exception {
Thread.sleep(1000);
List<Book> books = new ArrayList<Book>();
for (int i = 0; i < 15; i++) {
books.add(new Book("page" + page + " Java编程思想 " + i, 108.00d));
}
mPage = page;
return books;
}
});
return data;
}
use of com.shizhefei.mvc.http.okhttp.GetMethod in project MVCHelper by LuckyJayce.
the class BooksOkHttp_AsyncDataSource method loadBooks.
private RequestHandle loadBooks(final ResponseSender<List<Book>> sender, final int page) throws Exception {
GetMethod method = new GetMethod("https://www.baidu.com");
method.addHeader("a", "aaaaa");
method.addParam("api_key", "75ee6c644cad38dc8e53d3598c8e6b6c");
method.executeAsync(sender, new ResponseParser<List<Book>>() {
@Override
public List<Book> parse(Response response) throws Exception {
Thread.sleep(1000);
List<Book> books = new ArrayList<Book>();
for (int i = 0; i < 15; i++) {
books.add(new Book("page" + page + " Java编程思想 " + i, 108.00d));
}
mPage = page;
return books;
}
});
// });
return method;
}
use of com.shizhefei.mvc.http.okhttp.GetMethod in project MVCHelper by LuckyJayce.
the class GankMeizhiOkHttp_Datasource method load.
private RequestHandle load(ResponseSender<List<Meizhi>> sender, final int page) {
// http://gank.io/api/data/Android/10/1
String url = new UrlBuilder("http://gank.io/api/data").sp("福利").sp("10").sp(page).build();
GetMethod method = new GetMethod(url);
method.executeAsync(sender, new MeizhiParser<List<Meizhi>>() {
@Override
protected void onParse(Response responses, List<Meizhi> meizhis) {
mPage = page;
}
});
return method;
}