If you don't need all the features of the Apache HTTPClient component, you could use java.net. Chances are it's at leaset a bit faster. If your response is XML, you can parse the response as a stream instead of loading it into memory as a string.
On Thu, Dec 31, 2009 at 12:52 PM, SizzlingSkizzorsProgrammer < cbo...@gmail.com> wrote: > What is the best (fastest and most efficient) method of doing an HTTP > Request? > > Currently I use: > > DefaultHttpClient httpclient= new DefaultHttpClient(); > > HttpPost httpost = new HttpPost(uri); > > httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); > > HttpResponse response = httpclient.execute(httpost); > HttpEntity entity = response.getEntity(); > String sResponse = EntityUtils.toString(entity); > > if (close == true) > { > httpclient.getConnectionManager().shutdown(); > } > > if (entity != null) > { > entity.consumeContent(); > } > > return sResponse; > > > > It works fine, but it's quite slow...any way to make it faster? > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en