use of com.kymjs.rxvolley.http.Request in project yoo_home_Android by culturer.
the class OkHttpStack method performRequest.
@Override
public URLHttpResponse performRequest(Request<?> request, ArrayList<HttpParamsEntry> additionalHeaders) throws IOException {
OkHttpClient client = mClient.clone();
int timeoutMs = request.getTimeoutMs();
client.setConnectTimeout(timeoutMs, TimeUnit.MILLISECONDS);
client.setReadTimeout(timeoutMs, TimeUnit.MILLISECONDS);
client.setWriteTimeout(timeoutMs, TimeUnit.MILLISECONDS);
com.squareup.okhttp.Request.Builder okHttpRequestBuilder = new com.squareup.okhttp.Request.Builder();
okHttpRequestBuilder.url(request.getUrl());
for (final HttpParamsEntry entry : request.getHeaders()) {
okHttpRequestBuilder.addHeader(entry.k, entry.v);
}
for (final HttpParamsEntry entry : additionalHeaders) {
okHttpRequestBuilder.addHeader(entry.k, entry.v);
}
setConnectionParametersForRequest(okHttpRequestBuilder, request);
com.squareup.okhttp.Request okHttpRequest = okHttpRequestBuilder.build();
Call okHttpCall = client.newCall(okHttpRequest);
Response okHttpResponse = okHttpCall.execute();
return responseFromConnection(okHttpResponse);
}
use of com.kymjs.rxvolley.http.Request in project yoo_home_Android by culturer.
the class OkHttpStack method performRequest.
@Override
public URLHttpResponse performRequest(Request<?> request, ArrayList<HttpParamsEntry> additionalHeaders) throws IOException {
int timeoutMs = request.getTimeoutMs();
OkHttpClient client = mClient.newBuilder().readTimeout(timeoutMs, TimeUnit.MILLISECONDS).connectTimeout(timeoutMs, TimeUnit.MILLISECONDS).writeTimeout(timeoutMs, TimeUnit.MILLISECONDS).build();
okhttp3.Request.Builder okHttpRequestBuilder = new okhttp3.Request.Builder();
okHttpRequestBuilder.url(request.getUrl());
for (final HttpParamsEntry entry : request.getHeaders()) {
okHttpRequestBuilder.addHeader(entry.k, entry.v);
}
for (final HttpParamsEntry entry : additionalHeaders) {
okHttpRequestBuilder.addHeader(entry.k, entry.v);
}
setConnectionParametersForRequest(okHttpRequestBuilder, request);
okhttp3.Request okHttpRequest = okHttpRequestBuilder.build();
Call okHttpCall = client.newCall(okHttpRequest);
Response okHttpResponse = okHttpCall.execute();
return responseFromConnection(okHttpResponse);
}
Aggregations