commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: [SOLVED] Re: [httpclient] (3-rc3) How to set proxy host/port ?
Date Wed, 24 Aug 2005 15:01:04 GMT
On Wed, Aug 24, 2005 at 04:55:37PM +0200, Nicolas De Loof wrote:
> 
> Thanks for reply,
> 
> My problem is I'm using commons-httpclient from an Axis-generated web 
> service client. I don't create HttpClient myself.
> I've found a workaround by using :
> 
> static
> {
>        String proxyHost = System.getProperty("http.proxyHost");
>        String proxyPort = System.getProperty("http.proxyPort");
>        if (proxyHost != null && proxyPort != null)
>        {
>            int port = Integer.parseInt(proxyPort);
>            HostConfiguration.ANY_HOST_CONFIGURATION.setProxy(host, port);
>        }
> }
> 
> Notice I've reused java 'standard' system properties for proxy 
> configuration.
> 
> I have to test it in real world but it seems to work. Thanks for help anyway
> 

Nico,

This will most certainly produce side-effects. Be advised to not use
this workaround with the multithreaded HTTP connection manager. I do not
know much about Axis. I am pretty sure, though, Axis should be able to
expose the underlying HttpClient instance for customization

Oleg

> Nico.
> 
> Oleg Kalnichevski a ?crit :
> 
> >On Wed, Aug 24, 2005 at 04:14:31PM +0200, Nicolas De Loof wrote:
> > 
> >
> >>Hello,
> >>
> >>I'd like to set HTTP proxy configuration from an Axis client.
> >>
> >>I'm using a static bloc to setup commons-httpclient preferences (I'm 
> >>using PREEMPTIVE_AUTHENTICATION=true)
> >><code>
> >>static
> >>{
> >>  DefaultHttpParams
> >>          .setHttpParamsFactory(new CustomDefaultHttpParamsFactory());
> >>}
> >></code>
> >>
> >>Is they're any comparable property to set the proxy Host/Port to be used ?
> >>
> >>   
> >>
> >
> >Nico,
> >
> >How about that?
> >
> >HttpClient httpagent = new HttpClient();
> >httpagent.getHostConfiguration().setProxy("proxy",
> >	8080);
> >
> >Oleg
> >
> >
> > 
> >
> >>Nico.
> >>
> >>This message contains information that may be privileged or confidential 
> >>and is the property of the Capgemini Group. It is intended only for the 
> >>person to whom it is addressed. If you are not the intended recipient,  
> >>you are not authorized to read, print, retain, copy, disseminate,  
> >>distribute, or use this message or any part thereof. If you receive this  
> >>message in error, please notify the sender immediately and delete all  
> >>copies of this message.
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >>
> >>
> >>   
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> > 
> >
> 
> This message contains information that may be privileged or confidential 
> and is the property of the Capgemini Group. It is intended only for the 
> person to whom it is addressed. If you are not the intended recipient,  you 
> are not authorized to read, print, retain, copy, disseminate,  distribute, 
> or use this message or any part thereof. If you receive this  message in 
> error, please notify the sender immediately and delete all  copies of this 
> message.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 

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


Mime
View raw message