Search in sources :

Example 1 with Profiler

use of retrofit.Profiler in project divide by HiddenStage.

the class AbstractWebManager method createRestAdapter.

private RestAdapter createRestAdapter(Config config) {
    RestAdapter.Builder builder = new RestAdapter.Builder();
    builder.setClient(new OkClient(config.client)).setEndpoint(config.serverUrl).setLogLevel(RestAdapter.LogLevel.FULL).setLog(new RestAdapter.Log() {

        @Override
        public void log(String s) {
            retrologger.debug(s);
        }
    }).setConverter(new GsonConverter(new Gson())).setRequestInterceptor(new RequestInterceptor() {

        @Override
        public void intercept(RequestFacade requestFacade) {
            onRequest(requestFacade);
        }
    }).setProfiler(new Profiler() {

        @Override
        public Object beforeCall() {
            return null;
        }

        @Override
        public void afterCall(RequestInformation requestInformation, long l, int i, Object o) {
            retrologger.error("afterCall(" + requestInformation.getRelativePath() + ":" + requestInformation.getMethod() + ": " + i + " : " + o);
            requestEventPublisher.onNext(new RequestObject(requestInformation, l, i, o));
        }
    });
    return builder.build();
}
Also used : GsonConverter(retrofit.converter.GsonConverter) OkClient(retrofit.client.OkClient) Gson(com.google.gson.Gson) RequestInterceptor(retrofit.RequestInterceptor) RequestFacade(retrofit.RequestInterceptor.RequestFacade) Profiler(retrofit.Profiler) RestAdapter(retrofit.RestAdapter)

Aggregations

Gson (com.google.gson.Gson)1 Profiler (retrofit.Profiler)1 RequestInterceptor (retrofit.RequestInterceptor)1 RequestFacade (retrofit.RequestInterceptor.RequestFacade)1 RestAdapter (retrofit.RestAdapter)1 OkClient (retrofit.client.OkClient)1 GsonConverter (retrofit.converter.GsonConverter)1