You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Sagi Mann <sa...@googlemail.com> on 2007/10/21 19:59:58 UTC

How to set http proxy details without coding

Hello,
I was wondering if it is possible to set proxy info (host, port,
credentials, authscope, etc) without using code, i.e. via
configuration, external property file, etc. This way, I don't have to
implement my own config-reader just for these settings...

thanks,
sagimann

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


Re: How to set http proxy details without coding

Posted by Joshua Preston <jo...@tfcci.com>.
Roland et al.,

I successfully done just that by using the Spring Framework and  
dependency injection.  Basically, you setup a configuration bean for  
all of the settings you want to use in your application context and  
viola, an XML configurable http client that isn't hard coded.

Here's a piece of what I use:

...
     <bean id="proxyConfig"
         class="org.apache.commons.httpclient.ProxyHost">
         <constructor-arg>
             <!-- hostname of the proxy to use -->
             <value>proxy.domain.local</value>
         </constructor-arg>
         <!-- port to connect to on the proxy host -->
         <constructor-arg>
             <value>8080</value>
         </constructor-arg>
     </bean>
...

I'm not sure if anyone else would like a more detailed example, but  
if enough people are interested, I might be persuaded into putting  
something together.

Thanks,


Joshua Preston
joshua.preston@tfcci.com

> No. We have no idea where you - or any other HttpClient user - would
> like to read that config from, or in what format you'd like to have  
> it.

> Why don't you implement your own config-reader for all
> your application settings?

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


Re: How to set http proxy details without coding

Posted by Roland Weber <os...@dubioso.net>.
Sagi Mann wrote:
> Hello,
> I was wondering if it is possible to set proxy info (host, port,
> credentials, authscope, etc) without using code, i.e. via
> configuration, external property file, etc.

No. We have no idea where you - or any other HttpClient user - would
like to read that config from, or in what format you'd like to have it.

> This way, I don't have to
> implement my own config-reader just for these settings...

Why don't you implement your own config-reader for all
your application settings?

cheers,
  Roland


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