use of retrofit.RequestInterceptor.RequestFacade 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();
}
Aggregations