Laurent,
I will be more than happy to help you as far as HttpClient is concerned,
but I have always shunned away from applet programming at all costs, and
therefore can be of little assistence here. I _suppose_ if the browser is
equipped with the Sun's Java plugin, you _may_ be able to query the http.proxyHost
and http.proxyPort system properties. But this is no more than a wild guess
on my part.

Cheers, 

Oleg


>-- Original Message --
>Reply-To: "Jakarta Commons Users List" <[EMAIL PROTECTED]>
>Date: Fri, 19 Mar 2004 16:20:09 +0100
>From: Laurent For�t <[EMAIL PROTECTED]>
>To: Jakarta Commons Users List <[EMAIL PROTECTED]>
>Subject: Re: [HTTPClient]  How to use the cookie JSessionID ... becomes
How
> to pass clien
>
>
>Ok Great !!! thanks a lot, it seems to work now !
>
>Now, I am coming back to my initial problem.
>If I want to initialize my applet transparently, I need to get all these
>parameters from my client.
>
>Is there anyway to do this, in javascript ?
>
>I can not decently asked to the customer each time these 4 parameters.
>
>Laurent F
>
>
>[EMAIL PROTECTED] wrote:
>
>> Laurent.
>> One little detail is missing. HttpClient still does not know you want
to
>> go through the proxy. 
>> 
>> Just add one extra configuration line right after HttpClient instantiation
>> 
>> HttpClient client = new HttpClient();
>> client.getHostConfiguration().setProxy(PROXY_IP, PROXY_PORT);
>> 
>> In order to be able to see what exactly HttpClient is doing you may want
>> to turn  the wire/debug log when troubleshooting problems
>> 
>> <http://jakarta.apache.org/commons/httpclient/logging.html>
>> 
>> HTH
>> 
>> Oleg
>> 
>> 
>>>-- Original Message --
>>>Reply-To: "Jakarta Commons Users List" <[EMAIL PROTECTED]>
>>>Date: Fri, 19 Mar 2004 15:26:55 +0100
>>>From: Laurent For�t <[EMAIL PROTECTED]>
>>>To: Jakarta Commons Users List <[EMAIL PROTECTED]>
>>>Subject: Re: [HTTPClient]  How to use the cookie JSessionID ... becomes
>> 
>> How
>> 
>>>to pass client proxy Authorization through applet.
>>>
>>>
>>>I begin to understand how proxy works, now. And I think now that my previous
>>>question was stupid.
>>>
>>>This morning, I have configured a squid proxy with user authorization
and
>>>a firewall with which the 
>>> only possible connection to the web is through this proxy.
>>>
>>>I try the simplest program using proxy HttpClient, inspired from cvs example
>>>:
>>>
>>>  static String PROXY_IP = "195.46.214.114";
>>>  static String PROXY_USER = "squid";
>>>  static String PROXY_PASSWORD = "squid";
>>>
>>>
>>>   public static void main(String[] args) throws Exception {
>>>        HttpClient client = new HttpClient();
>>>     
>>>     //client.getState().setAuthenticationPreemptive(true);
>>>     client.getState().setAuthenticationPreemptive(true);
>>>
>>>        client.getState().setProxyCredentials(
>>>         // IP_PROXY,
>>>            null,
>>>            IP_PROXY,
>>>            new UsernamePasswordCredentials(PROXY_USER, PROXY_PASSWORD)
>>>        );
>>>
>>>     System.out.println(client.getState().toString());
>>>
>>>        GetMethod get = new GetMethod("http://www.google.com";);
>>>        get.setDoAuthentication( true );
>>>        try {
>>>            int status = client.executeMethod( get );
>>>            System.out.println(status + "\n" + get.getResponseBodyAsString());
>>>        } finally {
>>>            get.releaseConnection();
>>>        }
>>>    }
>>>
>>>This program ignore the proxyCredentials. And try to connect directly
with
>>>failure (due to the 
>>>firewall) to www.google.com
>>>What I have done wrong ?
>>>
>>>I am discouraged !!
>>>
>>>Laurent F.
>>>
>>>PS the output :
>>>[Authentication domain: '195.46.214.114', authentication realm: 
>>>'null'#squid:squidUser
>>>| 
>>>Authentication domain: '195.46.214.114', authentication realm: 
>>>'null'#squid:squidUser
>>>| ]
>>>java.net.SocketException: connect (code=10004)
>>>        at java.net.PlainSocketImpl.socketConnect(Native Method)
>>>        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:320)
>>>        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:133)
>>>        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:120)
>>>        at java.net.Socket.<init>(Socket.java:273)
>>>        at java.net.Socket.<init>(Socket.java:100)
>>>        at 
>>>org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:118)
>>>        at 
>>> org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:683)
>>>        at 
>>> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:662)
>>>        at 
>>> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:529)
>>>        at com.clipack.lfo.TestAuthentication.main(TestAuthentication.java:37)
>>>
>>>
>>>
>>>Laurent For�t wrote:
>>>
>>>>Ok, thanks a lot. I am sorry, I haven't seen that credentials was also
>>>
>>>>for Proxy Authentication.
>>>>
>>>>Another question, I hope it will be the last ;) :
>>>>
>>>>How do we know the values of String parameters for the 
>>>>UsernamePasswordCredentials constructor ?
>>>>Is it better to use the default ?
>>>>
>>>>Thanks again for all your help.
>>>>
>>>>Laurent F.
>>>>
>>>>
>>>>Oleg Kalnichevski wrote:
>>>>
>>>>
>>>>>On Thu, 2004-03-18 at 16:49, Laurent For�t wrote:
>>>>>
>>>>>
>>>>>>My problem is now,
>>>>>>
>>>>>>how to pass througn proxy Authorization using httpClient.
>>>>>>Is it managed by HttpClient, or do we have to provide code to manage
>>>
>>>?
>>>
>>>>>>If it is the case , how ?
>>>>>
>>>>>
>>>>>
>>>>>HttpClient does provide support for transparent proxy authentication.
>>>>>All you have to do is to add the required proxy credentials to the
>>>>>HttpState used by HttpClient. Please refer to the javadocs for details
>>>>>
>>>>>Oleg
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Thanks in advance.
>>>>>>
>>>>>>Laurent F.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>>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]
>>>>>
>>>>>
>>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>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]
>>>
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 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]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to