Best code examples for Android HttpClient class (org.apache.http.client.HttpClient)

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

Android HttpClient examples from Open Source projects
This code example shows how to use the following methods: execute, getConnectionManager
        } 
 
        @Override 
        public HttpResponse call() throws Exception {
            try { 
                return client.execute(new HttpGet(url));
            } finally { 
                client.getConnectionManager().closeExpiredConnections();
            } 
        } 
    } 
} 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: execute
    WebElement body = driver.findElement(By.xpath("//body"));
    assertEquals(FILE_CONTENTS, body.getText());
  } 
 
  private void assertUrlHasContentType(String url, String appcacheMimeType) {
    HttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet(url);
    HttpResponse response;
 
    try { 
      response = httpclient.execute(httpget);
    } catch (Throwable t) {
      throw Throwables.propagate(t);
    } 
 
    Header[] contentTypeHeaders = response.getHeaders("Content-Type");
    assertEquals(1, contentTypeHeaders.length);
    assertTrue(contentTypeHeaders[0].getValue().contains(appcacheMimeType));
  } 
} 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: execute
                 
        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);
        } 
         
        if (time == -1) {
            time = System.currentTimeMillis();
        } 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: execute
    return httpClient.getConnectionManager();
  } 
 
  @Implementation 
  public HttpResponse execute(HttpUriRequest httpUriRequest) throws IOException, ClientProtocolException {
    return httpClient.execute(httpUriRequest);
  } 
 
  @Implementation 
  public HttpResponse execute(HttpUriRequest httpUriRequest, HttpContext httpContext) throws IOException, ClientProtocolException {
    return httpClient.execute(httpUriRequest, httpContext);
  } 
 
  @Implementation 
  public HttpResponse execute(HttpHost httpHost, HttpRequest httpRequest) throws IOException, ClientProtocolException {
    return httpClient.execute(httpHost, httpRequest);
  } 
 
  @Implementation 
  public HttpResponse execute(HttpHost httpHost, HttpRequest httpRequest, HttpContext httpContext) throws IOException, ClientProtocolException {
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: execute
		else { 
			 
			ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
			nameValuePairs.add(new BasicNameValuePair("text", uploadstring));
			try{ 
				HttpClient httpclient = new DefaultHttpClient();
				String http = "http://";
				String controlIP = ((FrameworkAndroidApp) this.getApplication()).getcontrolIP();
				String path = ((FrameworkAndroidApp) this.getApplication()).getpath();
				String url = "/putfuncuploader.php";
				String uri = http.concat(controlIP);
				String postto1 = uri.concat(path);
				String postto = postto1.concat(url);
				HttpPost httppost = new HttpPost(postto);
				httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
				httpclient.execute(httppost);
				//HttpEntity entity = response.getEntity(); 
				//InputStream input = entity.getContent(); 
				}catch(Exception e){
 
				e.printStackTrace();
Full Snippet Info
7
CodeRank
Related Android HttpClient Questions & Answers:
Other Android HttpClient Examples
25:	
26:			// Creating HTTP client
27:			HttpClient httpClient = new DefaultHttpClient();
28:			// Creating HTTP Post
29:			HttpPost httpPost = new HttpPost(

Read More

See Code Examples for Android HttpClient Methods: