Code example for BasicHttpRequest

0
    SchemeRegistry registry = new SchemeRegistry();
    registry.register(
            new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
    SingleClientConnManager mgr = new MyClientConnManager(seed.getParams(),
        registry);
    DefaultHttpClient http = new DefaultHttpClient(mgr, seed.getParams());
    HttpGet method = new HttpGet(url);
    HttpResponse response = null;
    try { 
      Log.d(LOG_TAG, "starting download");
      response = http.execute(method);
      Log.d(LOG_TAG, "downloaded");
    } catch (ClientProtocolException e) {
      Log.e(LOG_TAG, "Error downloading", e);
    } catch (IOException e) {
      Log.e(LOG_TAG, "Error downloading", e);
    } 
    return response;
  } 
 
  private void processRequest(HttpRequest request, Socket client)