Wednesday, September 15, 2010

[android-developers] Re: HttpURLConnection or HttpClient

Yes, we know why. Because Apache's HttpClient (and other closely
assoc. classes in the org.apache.http package) is a much better API
than Sun's own HttpUrlConnection (and the rest of java.net's Http
support). You can do far more work with less code, and it reads much
better too.

So, for example, HttpClient has helper classes that help you deal with
spinning off a worker thread and doing all the waiting on HTTP there;
it is designed to work well asynchronously. Sun's HttpUrlConnection
has nothing of the sort.

That said, you don't get to depart from using java.net entirely. You
should still use it for dealing with URIs and URLs. But not for much
more.

On Sep 15, 2:41 pm, cindy <ypu01...@yahoo.com> wrote:
> Hi,
>
> I was told it was prefer to use Apache's library HttpClient, instead
> of java's Http URLConnection. Does any one know why?
>
> Thanks!
>
> Cindy

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment