[关闭]
@liter 2015-11-10T15:15:55.000000Z 字数 3808 阅读 2992

Android network framework: LiteHttp

litehttp2.x-tutorials


Website : http://litesuits.com

QQgroup : 47357508 , 42960650

Android网络框架为什么可以选用lite-http ?

lite-http 初步使用 和 快速上手


1. What‘s lite-http ?

LiteHttp is a simple, intelligent and flexible HTTP framework for Android. With LiteHttp you can make HTTP request with only one line of code!
It could convert a java model to the parameter and rander the response JSON as a java model intelligently.

2. Why choose lite-http ?

Simple, powerful, make HTTP request with only one line of code:

  1. User user = liteHttp.get (url, User.class);

asynchronous download a file(execute on sub-thread,listen on ui-thread):

  1. liteHttp.executeAsync(new FileRequest(url,path).setHttpListener(
  2. new HttpListener<File>(true, true, true) {
  3. @Override
  4. public void onLoading(AbstractRequest<File> request, long total, long len) {
  5. // loading notification
  6. }
  7. @Override
  8. public void onSuccess(File file, Response<File> response) {
  9. // successfully download
  10. }
  11. })
  12. );

configure an asynchronous login request by annotation:

  1. String loginUrl = "http://litesuits.com/mockdata/user_get";
  2. // 1. URL : loginUrl
  3. // 2. Parameter : name=value&password= value
  4. // 3. Response : User
  5. @HttpUri(loginUrl)
  6. class LoginParam extends HttpRichParamModel<User> {
  7. private String name;
  8. private String password;
  9. public LoginParam(String name, String password) {
  10. this.name = name;
  11. this.password = password;
  12. }
  13. }
  14. liteHttp.executeAsync(new LoginParam("lucy", "123456"));

will be built as http://xxx?name=lucy&password=123456

more details, you can see lite-http introduction: LiteHttp Introduction: Why should developers choose LiteHttp ?

3. What are the fetures ?

4. Overall architecture of lite-http

Lite-http Chart

About App architecture, see my other article:
How to take high-quality Android project framework, the framework of the structure described in detail?

5. tutorials and analysis (◕‸◕)

Good ◝‿◜, huh:

 1. Initialization and preliminary usage

 2. Simplified requests and non-safe method of use

 3. Automatic model conversion

 4. Custom DataParser and Json serialization library Replace

 5. Files, bitmap upload and download

 6. Disable network and traffic statistics

 7. Retries and redirect

 8. Exceptions handling and cancellation request

 9. Multiple data transmission via POST(PUT)

 10. Asynchronous concurrency and scheduling strategy

 11. Global configuration and parameter settings Detailed

 12. Annotation-Based request

 13. Multilayer cache mechanism and usage

 14. Detailed of callback listener

 15. SmartExecutor: concurrent scheduler

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注