> -----Original Message----- > From: Oleg Kalnichevski [mailto:[email protected]] > Sent: Wednesday, February 03, 2010 2:30 AM > To: HttpClient User Discussion > Subject: RE: Any up-to-date comparison of HttpClient vs. > HttpUrlConnection? > > On Sat, 2010-01-30 at 16:13 -0800, KARR, DAVID (ATTCINW) wrote: > > > -----Original Message----- > > > From: Oleg Kalnichevski [mailto:[email protected]] > > > Sent: Saturday, January 30, 2010 2:40 PM > > > To: HttpClient User Discussion > > > Subject: RE: Any up-to-date comparison of HttpClient vs. > > > HttpUrlConnection? > > > > > > On Fri, 2010-01-29 at 11:29 -0800, KARR, DAVID (ATTCINW) wrote: > > > > > > ... > > > > > > > > > > > > > http://java.sun.com/javase/7/docs/api/java/net/doc-files/net- > > > > > properties.html > > > > > > > > > > has a long list of properties. > > > > > > > > Can someone pick out features supported by those properties that > are > > > > supported on a client basis with HttpClient (as opposed to > setting > > > > system properties)? For instance, if I needed one connection to > use > > > > NTLM auth, but only that connection, would this mean that all > > > > connections using HttpUrlConnection would be forced to use NTLM > auth? > > > > Would HttpClient allow doing that on a client basis instead? > > > > > > > > > > HttpClient does not make use of system properties at all. Virtually > > > every aspect of the HTTP protocol can be overridden on a per > request > > > basis (using HTTP parameters) or on a per client / thread basis > (using > > > HTTP context). > > > > I'm aware of that. I'm just looking for specific examples of this, > where HUC implements it with a system property, and basically how > HttpClient provides it on a request or client basis. > > > > Timeouts for instance. > > > Even more important, I'm trying to determine if there are features > that HttpClient provides which just aren't practical at all with HUC. > For instance, is it possible to get "preemptive authentication" with > HUC? Is it possible to connect with SSL to a server using a self- > signed certificate with HUC? I'm familiar with doing preemptive auth > with HttpClient, but I only briefly read about the self-signed cert > issue a long time ago. > > Both scenarios should be possible with HUC. The problem is that HUC API > is just plain ugly and cumbersome, and this can affect your application > code. For example, one can use protocol interceptors with HttpClient in > order to introduce a cross cutting aspect for all outgoing requests and > incoming responses, which is simply not possible with HUC. So, the > differentiating factor is the quality of API, not the feature list. > Just > pick the one you like better.
Actually, timeouts is one area in HUC that was fixed in JDK 1.5. There are now setters for "readTimeout" and "connectionTimeout". Your point about the convenience of the API is well-taken.
