hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Porting Axis2 using commons-httpclient 3.1 to httpclient 4.0
Date Sat, 18 Apr 2009 00:01:33 GMT
On Fri, 2009-04-17 at 17:17 -0400, Jeudy, Guillaume wrote:
> Hi,


New API is partially documented in this tutorial:


> I'm attempting to port axis2 using commons-httpclient 3.1 to httpclient 4.0 locally.
I have a few questions because in some instances I could not find corresponding functionality
in 4.0 version.
> 1)  Is httpMethodBase.setDoAuthentication() still required in 4.0 ?

No it is not. There is a parameter to disable authentication if not

> My understanding is that such a switch is no longer required, httpclient 4.0 requests
will perform authentication by default if credentials are set and authschemes are properly
configured on the HttpClient object.
> 2) What about the Protocol interface implementations? The HostConfiguration class also
disappeared. I now use HttpHost to get equivalent functionality in 4.0. I cannot get equivalent
functionality for missing Protocol class in defunct HostConfiguration. Can somebody point
in the right direction here?

See Scheme

> 3) Preemptive authentication feature. Before it was easy as:
> httpClient.getParams().setAuthenticationPreemptive(true);   what is easiest way to migrate
to 4.0 way of doing it ?

See examples. There is a couple about preemptive authentication


>  4) Reorder auth scheme priority. before you could do things such as:
>   List schemes = authenticator.getAuthSchemes();
> authPrefs.add(AuthPolicy.BASIC);
> authPrefs.add(AuthPolicy.NTLM);
> httpClient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY,
>      authPrefs);
> I did not find such customizability in 4.0, any hints? Are all registered auth scheme
applied in indefinite order in 4.0?

Subclass DefaultTargetAuthenticationHandler and override
#getAuthPreferences() method

> 5) connection management before you had to do:
> try {
>    httpClient.executeMethod(config, method);
> } finally {
>      method.releaseConnection();
> }

See tutorial and examples. There is enough material about connection
management already. I'll be adding more in the coming days / months.

> to ensure the connection bound to the HttpMethodBase object is released. In 4.0 version,
are connections always released by default whenever httpClient.executeX() is called no matter
the outcome? If not please give more insight on how this works in 4.0.

However, before you seriously consider migrating Axis2 to HttpClient 4.0
you should get Axis folks to take a look at this issue:


I raised that issue almost a year ago. Still no reaction. I have pretty
much given up on Axis2.



> Thank you!
> -Guillaume
> ____________________________________________________________________________________________________
> This electronic mail (including any attachments) may contain information that is privileged,
confidential, and/or otherwise protected from disclosure to anyone other than its intended
recipient(s). Any dissemination or use of this electronic email or its contents (including
any attachments) by persons other than the intended recipient(s) is strictly prohibited. If
you have received this message in error, please notify us immediately by reply email so that
we may correct our internal records. Please then delete the original message (including any
attachments) in its entirety. Thank you.

To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message