Best code examples for Android BasicHttpParams class (org.apache.http.params.BasicHttpParams)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android BasicHttpParams class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android BasicHttpParams examples from Open Source projects
This code example shows how to use the following methods:
    protected String generateTimestamp() {
         
        long time = -1;
                 
        try { 
            HttpParams httpParams = new BasicHttpParams();
            HttpConnectionParams.setSoTimeout(httpParams, SOCKET_TIMEOUT);
            HttpConnectionParams.setConnectionTimeout(httpParams, CONNECTION_TIMEOUT);
            HttpClient httpClient = new DefaultHttpClient(httpParams);
            HttpGet httpget = new HttpGet(TIMER_URL);
            HttpResponse response = httpClient.execute(httpget);
            HttpEntity entity = response.getEntity();
            if (entity != null) {
                time = Long.parseLong(EntityUtils.toString(entity),10);
                logger.debug("Got remote timestamp {}", time);
            } 
        } catch (IOException e) {
            logger.warn("Error obtaining the synchronized remote timestamp, defaulting to the local one",e);
        } 
         
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods:
 
	private Util() { 
	} 
 
	public static HttpParams getTimeoutHttpParams() {
		HttpParams params = new BasicHttpParams();
		HttpConnectionParams.setConnectionTimeout(params, CONNECTION_TIMEOUT);
		HttpConnectionParams.setSoTimeout(params, SOCKET_TIMEOUT);
		return params;
	} 
 
	public static void closeStream(Closeable stream) {
		if (stream != null) {
			try { 
				stream.close();
				stream = null;
			} catch (IOException e) {
				Log.w(TAG, "Close stream exception", e);
			} 
		} 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setIntParameter
 
    return gridClient;
  } 
 
  public HttpParams getHttpParams() {
    HttpParams params = new BasicHttpParams();
    HttpConnectionParams.setSoReuseaddr(params, true);
    HttpConnectionParams.setConnectionTimeout(params, 120 * 1000);
    HttpConnectionParams.setSoTimeout(params, TIMEOUT_THREE_HOURS);
    params.setIntParameter(ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE, 0);
    HttpConnectionParams.setStaleCheckingEnabled(params, true);
    return params;
  } 
 
  public HttpRoutePlanner getRoutePlanner(SchemeRegistry registry) {
    return new ProxySelectorRoutePlanner(registry, ProxySelector.getDefault());
  } 
 
  public HttpParams getGridHttpParams(int connection_timeout, int socket_timeout){
    final HttpParams params = getHttpParams();
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBooleanParameter, setIntParameter
      connectionManager = localConnectionManager;
       
      int socketTimeout = 900000;
      int connectionTimeout = 60000;
       
      BasicHttpParams params = new BasicHttpParams();
      // This one is essential to prevent us from reading from the content stream before necessary during auth, but 
      // is incompatible with some proxies. 
      params.setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE,true);
      // Enabled for Solr, but probably not necessary for better-behaved ES 
      //params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY,true); 
      params.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,true);
      params.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS,true);
      params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT,socketTimeout);
      params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,connectionTimeout);
      params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS,true);
      DefaultHttpClient localClient = new DefaultHttpClient(connectionManager,params);
      // No retries 
      localClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler()
        { 
          public boolean retryRequest( 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBooleanParameter, setIntParameter
      connectionManager = localConnectionManager;
 
      int socketTimeout = 900000;
      int connectionTimeout = 60000;
       
      BasicHttpParams params = new BasicHttpParams();
      // This one is essential to prevent us from reading from the content stream before necessary during auth, but 
      // is incompatible with some proxies. 
      params.setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE,true);
      // Enabled for Solr, but probably not necessary for better-behaved ES 
      //params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY,true); 
      params.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,true);
      params.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS,true);
      params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT,socketTimeout);
      params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,connectionTimeout);
      params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS,true);
      DefaultHttpClient localClient = new DefaultHttpClient(connectionManager,params);
      // No retries 
      localClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler()
        { 
          public boolean retryRequest( 
Full Snippet Info
7
CodeRank
Related Android BasicHttpParams Questions & Answers:
See Code Examples for Android BasicHttpParams Methods: