Hello Jaya,
> Currently this is what we are doing:
>
> if (isBasicAuthRequired) {
> httpClient.getState().setAuthenticationPreemptive(true);
> Credentials creds = new
> UsernamePasswordCredentials(basicCreds.getUserName(),
> basicCreds.getPassword());
> httpClient.getState().setCredentials(null, basicCreds.getHost(),
> creds);
> }
Don't use httpClient.getState() anymore. Use a specific state
for each separate context, call methods directly at that state.
Then pass that state to the execute method, as Oleg suggested.
hope that helps,
Roland
>
> Will this take care of correct authentication?
> Thanks!
>
> Regards,
> Jaya.
>
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED]
>
> Sent: Thursday, December 15, 2005 5:46 PM
> To: [email protected]
> Subject: Re: Proxy authentication on per Method/Connection basis
>
> On Thu, Dec 15, 2005 at 05:32:35PM +0530, Jaya Christina B wrote:
> >
>
> > Hello,
> >
>
> > We are facing problems with proxy authentication (HttpClient V3).
> >
>
> > We create one HttpClient for the entire application (singleton object)
>
> > & are setting the Proxy Authentication for the HttpClient as follows.
> > We use MultiThreadedHttpConnectionManager for handling the
> connections.
> >
>
> > if (isProxyAuthRequired) {
> > httpClient.getHostConfiguration().setProxy(proxyCreds.getHost(),
> > proxyCreds.getPort());
> > Credentials creds = new
> > UsernamePasswordCredentials(proxyCreds.getUserName(),
> > proxyCreds.getPassword());
> > httpClient.getState().setProxyCredentials(null,
> > proxyCreds.getHost(), creds);
> > }
> >
>
> >
>
> > Depending on "isProxyAuthRequired", we want to execute proxy
>
> > authentication for a connection/method or not.
> > What is happening is, once a set of proxy authentication is set for
>
> > one Method/URL, the same is getting used for the next call also, even
>
> > when "isProxyAuthRequired" is set to false, that is, even if we dont
>
> > call this implicitly.
> >
>
> > Is it possible to set Proxy & Basic authentication on Method basis. I
>
> > read that this is possible by creating a connection for every method.
> > But as we use MultiThreadedHttpConnectionManager , this would not be
>
> > possible.
> >
>
> > Please could you help.
> > TIA.
> >
>
> > Regards,
> > Jaya.
> >
>
>
> Jaya,
>
> Use HttpClient#executeMethod(HostConfiguration, HttpMethod, HttpState)
> to pass an individual host config / http state for a given method
>
> http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/
> httpclient/HttpClient.html#executeMethod(org.apache.commons.httpclient.H
> ostConfiguration,%20org.apache.commons.httpclient.HttpMethod,%20org.apac
> he.commons.httpclient.HttpState)
>
> Hope this helps
>
> Oleg
>
> > *********************************************************
> > Disclaimer:
> >
>
> > The contents of this E-mail (including the contents of the
> enclosure(s) or attachment(s) if any) are privileged and confidential
> material of MBT and should not be disclosed to, used by or copied in any
> manner by anyone other than the intended addressee(s). In case you are
> not the desired addressee, you should delete this message and/or
> re-direct it to the sender. The views expressed in this E-mail message
> (including the enclosure(s) or attachment(s) if any) are those of the
> individual sender, except where the sender expressly, and with
> authority, states them to be the views of MBT.
> >
>
> > This e-mail message including attachment/(s), if any, is believed to
>
> > be free of any virus. However, it is the responsibility of the
>
> > recipient to ensure that it is virus free and MBT is not responsible
>
> > for any loss or damage arising in any way from its use
> >
>
> > *********************************************************
> >
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail:
>
> > [EMAIL PROTECTED]
> >
>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> *********************************************************
> Disclaimer:
>
> The contents of this E-mail (including the contents of the
> enclosure(s) or attachment(s) if any) are privileged and
> confidential material of MBT and should not be disclosed to, used by
> or copied in any manner by anyone other than the intended
> addressee(s). In case you are not the desired addressee, you
> should delete this message and/or re-direct it to the sender. The
> views expressed in this E-mail message (including the enclosure(s)
> or attachment(s) if any) are those of the individual sender, except
> where the sender expressly, and with authority, states them to be
> the views of MBT.
>
> This e-mail message including attachment/(s), if any, is believed to
> be free of any virus. However, it is the responsibility of the
> recipient to ensure that it is virus free and MBT is not responsible
> for any loss or damage arising in any way from its use
>
> *********************************************************
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]