hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Many services with different configurations ...
Date Thu, 18 Feb 2010 20:10:02 GMT
Kaiser Sose wrote:
> 
> olegk wrote:
>> Yes, you can and you basically should.
>> [...]
>> By using HttpRequest#getParams()
>> Hope this helps
>>
> 
> Oleg,
> thanks for your help. I've fixed and everything is working good but I have
> one more question that I really don't know how to handle since I am
> "replacing" a very old manager (I don't have sources) -- All services are
> stored in an properties file like this
> 
> [service x]
> it.service.x.name=servicenamex
> it.service.x.host=aproxy.com
> it.service.x.timeout=5000
> it.service.x.encoding=UTF-8
> it.service.x.uri=http://serviceXtoquery/servicepage.ext
> 
> [service y]
> it.service.y.name=servicenamey
> it.service.y.host=http://serviceYtoquery
> it.service.y.timeout=10000
> it.service.y.encoding=UTF-8
> it.service.y.uri=serviceYpage
> 
> As you can see a general service X can use a general proxy (different
> services can use different a proxy) while a general service Y don't use a
> proxy, but his field host contain just the hostname and uri contains just
> the page to "paste" to the host. How can I handle it in my code since I
> don't know whether I have to set a proxy or not? My "migration" has to be as
> silent as possible so my Manager has same name of the old one and method
> like
> 
> MakeGetRequest(serviceName, Host, Uri);
> 
> (the name was used in order to get a particular connection pool in the old
> manager)
> 
> Is there a way to handle it in HttpClient?
> 

Carlo,

Proxy settings can be configured on a per request basis. You can set the 
proxy for each request based on the host name in the request uri.

A somewhat cleaner solution would be providing a custom route planner:

http://hc.apache.org/httpcomponents-client/httpclient/apidocs/org/apache/http/conn/routing/HttpRoutePlanner.html
http://hc.apache.org/httpcomponents-client/tutorial/html/connmgmt.html#d4e454

Hope this helps

Oleg


> Sorry for long question but I am crashing my head on monitor in last 2 days
> :-)
> 
> Best Regards
> 
> Carlo
> 
> 



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


Mime
View raw message