use of com.squareup.okhttp.Request in project pinpoint by naver.
the class HttpEngineSendRequestMethodInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
if (!validate(target)) {
return;
}
try {
SpanEventRecorder recorder = trace.currentSpanEventRecorder();
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
// typeCheck validate();
Request request = ((UserRequestGetter) target)._$PINPOINT$_getUserRequest();
if (request != null) {
try {
recorder.recordAttribute(AnnotationKey.HTTP_URL, InterceptorUtils.getHttpUrl(request.urlString(), param));
final String endpoint = getDestinationId(request.url());
recorder.recordDestinationId(endpoint);
} catch (Exception ignored) {
logger.warn("Failed to invoke of request.url(). {}", ignored.getMessage());
}
recordRequest(trace, request, throwable);
}
// clear attachment.
InterceptorScopeInvocation invocation = interceptorScope.getCurrentInvocation();
if (invocation != null && invocation.getAttachment() != null) {
invocation.removeAttachment();
}
} finally {
trace.traceBlockEnd();
}
}
use of com.squareup.okhttp.Request in project LookLook by xinghongfei.
the class OkHttpUtils method postRequest.
private void postRequest(String url, final ResultCallback callback, List<Param> params) {
Request request = buildPostRequest(url, params);
deliveryResult(callback, request);
}
use of com.squareup.okhttp.Request in project LookLook by xinghongfei.
the class OkHttpUtils method buildPostRequest.
private Request buildPostRequest(String url, List<Param> params) {
FormEncodingBuilder builder = new FormEncodingBuilder();
for (Param param : params) {
builder.add(param.key, param.value);
}
RequestBody requestBody = builder.build();
return new Request.Builder().url(url).post(requestBody).build();
}
use of com.squareup.okhttp.Request in project ETSMobile-Android2 by ApplETS.
the class AppletsApiSponsorRequest method loadDataFromNetwork.
@Override
public SponsorList loadDataFromNetwork() throws Exception {
String address = context.getString(R.string.applets_api_sponsors);
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(address).get().build();
Response response = client.newCall(request).execute();
String result = response.body().string();
SponsorList sponsors = new Gson().fromJson(result, SponsorList.class);
return sponsors;
}
use of com.squareup.okhttp.Request in project ETSMobile-Android2 by ApplETS.
the class AppletsApiCalendarRequest method loadDataFromNetwork.
@Override
public EventList loadDataFromNetwork() throws Exception {
String url = context.getString(R.string.applets_api_calendar, "ets", startDate, endDate);
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(url).get().build();
Response response = client.newCall(request).execute();
String calendarJson = response.body().string();
return new Gson().fromJson(calendarJson, EventList.class);
}
Aggregations