Search in sources :

Example 1 with LoggerInterceptor

use of com.benmu.framework.http.okhttp.log.LoggerInterceptor in project WeexErosFramework by bmfe.

the class AxiosManager method createClient.

public OkHttpClient createClient(Context context, long timeout) {
    CookieJarImpl cookieJar = new CookieJarImpl(new BMPersistentCookieStore(context));
    OkHttpClient.Builder builder = new OkHttpClient.Builder().addInterceptor(new LoggerInterceptor("TAG")).connectTimeout(timeout == 0 ? 3000L : timeout, TimeUnit.MILLISECONDS).readTimeout(timeout == 0 ? 30000L : timeout, TimeUnit.MILLISECONDS).cookieJar(cookieJar);
    if (DebugableUtil.isDebug()) {
        builder.addNetworkInterceptor(new WeexOkhttp3Interceptor());
    }
    return builder.build();
}
Also used : BMPersistentCookieStore(com.benmu.framework.http.BMPersistentCookieStore) OkHttpClient(okhttp3.OkHttpClient) LoggerInterceptor(com.benmu.framework.http.okhttp.log.LoggerInterceptor) WeexOkhttp3Interceptor(com.benmu.framework.extend.adapter.WeexOkhttp3Interceptor) CookieJarImpl(com.benmu.framework.http.okhttp.cookie.CookieJarImpl) OkHttpRequestBuilder(com.benmu.framework.http.okhttp.builder.OkHttpRequestBuilder) OtherRequestBuilder(com.benmu.framework.http.okhttp.builder.OtherRequestBuilder) GetBuilder(com.benmu.framework.http.okhttp.builder.GetBuilder) PostFormBuilder(com.benmu.framework.http.okhttp.builder.PostFormBuilder)

Aggregations

WeexOkhttp3Interceptor (com.benmu.framework.extend.adapter.WeexOkhttp3Interceptor)1 BMPersistentCookieStore (com.benmu.framework.http.BMPersistentCookieStore)1 GetBuilder (com.benmu.framework.http.okhttp.builder.GetBuilder)1 OkHttpRequestBuilder (com.benmu.framework.http.okhttp.builder.OkHttpRequestBuilder)1 OtherRequestBuilder (com.benmu.framework.http.okhttp.builder.OtherRequestBuilder)1 PostFormBuilder (com.benmu.framework.http.okhttp.builder.PostFormBuilder)1 CookieJarImpl (com.benmu.framework.http.okhttp.cookie.CookieJarImpl)1 LoggerInterceptor (com.benmu.framework.http.okhttp.log.LoggerInterceptor)1 OkHttpClient (okhttp3.OkHttpClient)1