hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Madeleine Wright <m.wri...@ru.ac.za>
Subject Re: getting through a proxy server
Date Fri, 08 Oct 2004 17:59:11 GMT
Progress - just moved the GetMethod constructor down below the logging 
details.  Now, though I still get a cache MISS at first, I don't get an 
authentication refusal.  I also tried moving the credential details 
higher than the host configuration, but that didn't make any difference.

Madeleine

Oleg Kalnichevski wrote:

>Bob,
>You are absolutely right about method.getHostConfiguration() taking
>precedence over client.getHostConfiguration(). However, HttpClient does
>copy the proxy information from the agent host config to the method host
>config. So, that should not be the reason for proxy problems Madeleine
>has been having.
> 
>We realize this can be horribly confusing. As of release 3.0 the use of
>HttpMethod#getHostConfiguration() will be deprecated and discouraged
>
>Oleg
>
>
>On Fri, 2004-10-08 at 17:01, St Jacques, Robert wrote:
>  
>
>>I believe that your problem is the fact that by calling the "GetMethod(url)"
>>constructor, you are creating a method with its own host configuration; in
>>this case, the method's host configuration is used when the method is
>>executed (as opposed to the default host configuration that you have created
>>on the connection).
>>
>>In other words, the host, port, and path information for the specific method
>>invocation are extracted from the URL that you used to construct the
>>GetMethod.  If you replace this code:
>>
>>client.getHostConfiguration()...
>>
>>with this code:
>>
>>method.getHostConfiguration()...
>>
>>You should be all set.  Either that or call the parameter-less GetMethod
>>constructor, which will cause it to default to the host configuration for
>>your client.
>>
>>OR you could call:
>>
>>client.executeMethod( client.getHostConfiguration(), method,
>>client.getState())
>>
>>That should work, too.
>>
>>Hope that helps,
>>Bob
>>
>>-----Original Message-----
>>From: Yuzwa, Erik [mailto:Erik.Yuzwa@encana.com] 
>>Sent: Friday, October 08, 2004 10:53 AM
>>To: 'Commons HttpClient Project'
>>Subject: RE: getting through a proxy server
>>
>>
>>Madeleine,
>>
>>Stupid question but is your proxy server using NTLM authentication? 
>>
>>I had to do some hoop jumping to get NTLM to work properly, but it's working
>>now if you need some code.
>>
>>Erik
>>
>>-----Original Message-----
>>From: Madeleine Wright [mailto:m.wright@ru.ac.za] 
>>Sent: Friday, October 08, 2004 8:46 AM
>>To: Commons HttpClient Project
>>Subject: getting through a proxy server
>>
>>
>>Please can someone suggest the simplest way to access a URL 
>>programatically through a proxy server?  I'm using HttpClient and the 
>>proxy bits of my code look like this (everything else works fine - I can 
>>access all sites inside the firewall):
>>
>>HttpClient client = new HttpClient();
>>................. client.getHostConfiguration().setProxy(proxyHost,
>>proxyPort); Credentials creds = new UsernamePasswordCredentials(userName,
>>password); client.getState().setProxyCredentials(realm, proxyHost,
>>defaultcreds); ....................... GetMethod method = new
>>GetMethod(url);
>>
>>I realize I seem to be supplying proxy host details twice!  But I can't 
>>otherwise see how to set the proxy port?  I keep getting an "access 
>>denied" message from the proxy server, indicating that I have not 
>>authenticated myself.  Does anyone know how I do that other than the 
>>method above (I am sure the actual proxy details given are correct).
>>
>>Thanks.
>>
>>Mad
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail:
>>commons-httpclient-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail:
>>commons-httpclient-dev-help@jakarta.apache.org
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail:
>>commons-httpclient-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail:
>>commons-httpclient-dev-help@jakarta.apache.org
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
>>    
>>
>
>***************************************************************************************************
>The information in this email is confidential and may be legally privileged.  Access to
this email by anyone other than the intended addressee is unauthorized.  If you are not the
intended recipient of this message, any review, disclosure, copying, distribution, retention,
or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful.
 If you are not the intended recipient, please reply to or forward a copy of this message
to the sender and delete the message, any attachments, and any copies thereof from your system.
>***************************************************************************************************
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Mime
View raw message