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: changing authscheme preference using spring dependency injection
Date Wed, 04 Jul 2012 09:27:43 GMT
On Tue, 2012-07-03 at 10:12 -0700, Travis Roberson wrote:
> Hi there -
> 
> I'm looking to change the authentication preference order for a Java based Soap client
I'm currently using with httpclient 4.2.  I've poured over the web and so far I've come up
short.
> 
> Here's what I'm basically looking to do in my spring context:
> 
> List<String> authtypes = new ArrayList<String>();
>         authtypes.add(AuthPolicy.NTLM);
>         authtypes.add(AuthPolicy.DIGEST);
>         authtypes.add(AuthPolicy.BASIC);
>         httpclient.getParams().setParameter(AuthPNames.PROXY_AUTH_PREF,
>                 authtypes);
>         httpclient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF,
>                 authtypes);
> 
> 
> The basic outline in spring should in my opinion look something like this:
> 
> <bean id="httpParams" class="org.apache.http.params.HttpParams">
>       <constructor-arg type="java.lang.String" value=" http.auth.target-scheme-pref"
/>
>       <constructor-arg type="java.lang.Object">
>       <ref bean="authPref"/>
>       </constructor-arg>
>     </bean>
> 
>       <bean id="httpClient" class="org.apache.http.impl.client.DefaultHttpClient">
>         <constructor-arg index="0" ref="httpParams"/>
>     </bean>
> 
> 
> 
>     <util:list id="authPref" value-type="java.lang.String">
>     <value>AuthPolicy.NTLM</value>
>     <value>AuthPolicy.DIGEST</value>
>       </util:list>
> 
> 
> But so far I'm not having any luck as the httpParam bean is complaining about not finding
the proper constructor.  Any insight on how this might be done correctly?
> 

HttpParams API does not work well with XML based Spring app contexts. I
guess the only reasonable way to work the problem around is to create a
custom factory bean.

Oleg


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


Mime
View raw message