use of okhttp3.logging.HttpLoggingInterceptor in project open-event-orga-app by fossasia.
the class NetworkModule method loggingInterceptor.
@Provides
@Singleton
HttpLoggingInterceptor loggingInterceptor() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
return interceptor;
}
use of okhttp3.logging.HttpLoggingInterceptor in project dhis2-android-sdk by dhis2.
the class D2Factory method create.
public static D2 create(String url, DatabaseAdapter databaseAdapter) {
ConfigurationModel config = ConfigurationModel.builder().serverUrl(HttpUrl.parse(url)).build();
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);
return new D2.Builder().configuration(config).databaseAdapter(databaseAdapter).okHttpClient(new OkHttpClient.Builder().addInterceptor(BasicAuthenticatorFactory.create(databaseAdapter)).addInterceptor(loggingInterceptor).build()).build();
}
use of okhttp3.logging.HttpLoggingInterceptor in project apps-android-wikipedia by wikimedia.
the class OkHttpConnectionFactory method createClient.
@NonNull
private static OkHttpClient createClient() {
SharedPreferenceCookieManager cookieManager = SharedPreferenceCookieManager.getInstance();
// TODO: consider using okhttp3.CookieJar implementation instead of JavaNetCookieJar wrapper
CookieJar cookieJar = new JavaNetCookieJar(cookieManager);
return new OkHttpClient.Builder().cookieJar(cookieJar).cache(NET_CACHE).addInterceptor(new HttpLoggingInterceptor().setLevel(Prefs.getRetrofitLogLevel())).addInterceptor(new UnsuccessfulResponseInterceptor()).addInterceptor(new StatusResponseInterceptor(RbSwitch.INSTANCE)).addNetworkInterceptor(new StripMustRevalidateResponseInterceptor()).addInterceptor(new CommonHeaderRequestInterceptor()).addInterceptor(new DefaultMaxStaleRequestInterceptor()).addInterceptor(new CacheControlRequestInterceptor()).addInterceptor(new OfflineCacheInterceptor(SAVE_CACHE)).addInterceptor(new WikipediaZeroResponseInterceptor(WikipediaApp.getInstance().getWikipediaZeroHandler())).addInterceptor(new TestStubInterceptor()).build();
}
use of okhttp3.logging.HttpLoggingInterceptor in project Varis-Android by dkhmelenko.
the class NetworkModule method okHttpClient.
@Provides
@Singleton
public static OkHttpClient okHttpClient() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
return new OkHttpClient.Builder().addInterceptor(interceptor).followRedirects(false).followSslRedirects(false).build();
}
use of okhttp3.logging.HttpLoggingInterceptor in project zype-android by zype.
the class ZypeApi method getInstance.
public static synchronized ZypeApi getInstance() {
if (instance == null) {
instance = new ZypeApi();
// Needs to log retrofit calls
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
Gson gson = new GsonBuilder().setLenient().create();
retrofit = new Retrofit.Builder().baseUrl(BASE_URL).client(client).addConverterFactory(GsonConverterFactory.create(gson)).build();
apiImpl = retrofit.create(IZypeApi.class);
}
return instance;
}
Aggregations