ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Sarrat" <olivier_sar...@hotmail.com>
Subject Re: Connections through a HTTP proxy
Date Thu, 01 Jan 1970 00:00:00 GMT



>Yes, I think we should add a method with your code for setting the HTTP
>proxy to XmlRpcClient.
>
>System.setProperty() is a static method and it sets the property for the
>whole runtime, so it won't be possible to set the proxy per client
>instance. I would propose to add a static method
>
>  public static void setHttpProxy (String host, int port, String auth)
>
>to XmlRpcClient.
>
>Hannes
>
>

True, this method should be static.

I would just propose a slightly different method :

public static void setHttpProxy (String host, int port, String name, String 
password)

... in order to bind the coding of the proxyAuthorization String. (which 
used a weird class (sun.misc.BASE64Encoder) a user in a hurry wouldn't like 
to look for)

Olivier.

>Martin Skopp wrote:
>
>>Thanks for the solution Olivier,
>>
>>but on the other hand - shouldn't your "XmlRpcClientPlus" class
>>somehow go into the release?
>>
>>IMHO, XmlRpcClient should offer those proxy-settings via Constructor -
>>if it's not on the "Commit" list for development already, it should
>>urgently go there, 'cause I can imagine it's frequently needed...
>>
>>Cheers,
>>Martin
>>
>>At 14:05 13.02.2002 +0000, Olivier Sarrat wrote:
>>
>>>>I'm trying to connect from RPC client to RPC server through a HTTP
>>>>proxy
>>>>for 2 reasons:
>>>>
>>>>         Properties properties = System.getProperties();
>>>>         properties.setProperty("proxyHost", "http://localhost");
>>>>         properties.setProperty("proxyPort", "8080");
>>>>         properties.setProperty("proxySet", "true");
>>>>         ...
>>>
>>>The problem is that you have to deal not only with system properties
>>>in order to go through a firewall. You have to add the login/password
>>>to the connection object itself... which means you have to go inside
>>>the implementation of the client.
>>>
>>>The way I did it, is by adding so very few lines at the good place of
>>>the XmlRpcClient.Worker :
>>>
>>>System.setProperty("http.proxySet","true");
>>>System.setProperty("http.proxyHost",proxyHost);
>>>System.setProperty("http.proxyPort",proxyPort);
>>>con.setRequestProperty ("Proxy-Authorization",proxyAuthorization);
>>>
>>>with proxyAuthorization being :
>>>proxyAuthorization = "Basic " + new sun.misc.BASE64Encoder
>>>().encode((user + ":" + password).getBytes());
>>>
>>>and con, the UrlConnection object.
>>
>>
>>
>>
>>
>>Martin Skopp
>
>
>
>




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


Mime
View raw message