コード例 #1
0
 @Override
 protected void setUserAgent(String userAgent) {
   super.setUserAgent(userAgent);
   if (mHttpClient != null) {
     HttpParams params = mHttpClient.getParams();
     HttpProtocolParams.setUserAgent(params, config.getUserAgent());
     mHttpClient.setParams(params);
     HttpLog.i(TAG, "lite-http set User-Agent: " + userAgent);
   }
 }
コード例 #2
0
 @Override
 protected void setConfigForRetryHandler(int retrySleepMillis, boolean requestSentRetryEnabled) {
   super.setConfigForRetryHandler(retrySleepMillis, requestSentRetryEnabled);
   retryHandler =
       new HttpRetryHandler(config.getRetrySleepMillis(), config.isRequestSentRetryEnabled());
   HttpLog.i(
       TAG,
       "lite-http set retrySleepMillis"
           + retrySleepMillis
           + " , requestSentRetryEnabled: "
           + requestSentRetryEnabled);
 }
コード例 #3
0
 @Override
 public void initConfig(HttpConfig config) {
   if (config == null) {
     config = new HttpConfig(null);
   }
   super.initConfig(config);
   retryHandler =
       new HttpRetryHandler(config.getRetrySleepMillis(), config.isRequestSentRetryEnabled());
   if (mHttpClient != null) {
     HttpParams params = mHttpClient.getParams();
     HttpConnectionParams.setConnectionTimeout(params, config.getConnectTimeout());
     HttpConnectionParams.setSoTimeout(params, config.getSocketTimeout());
     HttpConnectionParams.setSocketBufferSize(params, config.getSocketBufferSize());
     HttpProtocolParams.setUserAgent(params, config.getUserAgent());
     mHttpClient.setParams(params);
   }
 }
コード例 #4
0
 @Override
 protected void setConfigForHttpParams(
     int connectTimeout, int socketTimeout, int socketBufferSize) {
   super.setConfigForHttpParams(connectTimeout, socketTimeout, socketBufferSize);
   if (mHttpClient != null) {
     HttpParams params = mHttpClient.getParams();
     HttpConnectionParams.setConnectionTimeout(params, config.getConnectTimeout());
     HttpConnectionParams.setSoTimeout(params, config.getSocketTimeout());
     HttpConnectionParams.setSocketBufferSize(params, config.getSocketBufferSize());
     mHttpClient.setParams(params);
     HttpLog.i(
         TAG,
         "lite-http set connectTimeout"
             + connectTimeout
             + " , socketTimeout: "
             + socketTimeout
             + " , socketBufferSize: "
             + socketBufferSize);
   }
 }