litesuits / android-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.
http://litesuits.com?form=ghttp
Apache License 2.0
830 stars 347 forks source link

请问新版LiteHttp怎么用,没有了newApacheHttpClient() #29

Open huangboheng opened 7 years ago

huangboheng commented 7 years ago

文档没更新,protected的构造函数也不能new出来,也没有单例的方法

CB2Git commented 7 years ago

请问你解决了么,我在源码里面就看到一个build,但是其实就是直接返回了了HttpConfig对象,并没有初始化里面的config成员变量

public class LiteHttp {

private static final String TAG = LiteHttp.class.getSimpleName();

protected HttpConfig config;
protected final Object lock = new Object();
protected StatisticsInfo statisticsInfo = new StatisticsInfo();
protected AtomicLong memCachedSize = new AtomicLong();
protected ConcurrentHashMap<String, HttpCache> memCache = new ConcurrentHashMap<String, HttpCache>();

public static HttpConfig build(Context context) {
    return new HttpConfig(context);
}

protected LiteHttp(HttpConfig config) {
    initConfig(config);
}
flyjin commented 7 years ago

可以.create

feiyuu commented 7 years ago

新的创建对象的方式 HttpConfig config = LiteHttp.build(context) .setDebugged(false) .setDetectNetwork(true) 。。。

LiteHttp liteHttp = config.create();