hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kaiser Sose <carlo.bertucc...@live.it>
Subject Re: Many services with different configurations ...
Date Thu, 18 Feb 2010 08:26:47 GMT

olegk wrote:
> Yes, you can and you basically should.
> [...]
> By using HttpRequest#getParams()
> Hope this helps

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]

[service y]

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

MakeGetRequest(serviceName, Host, Uri);

(the name was used in order to get a particular connection pool in the old

Is there a way to handle it in HttpClient?

Sorry for long question but I am crashing my head on monitor in last 2 days

Best Regards


> Sorry if its a stupid question but I am new to Java and to those
> components
> and I am little bit in confusion with all these new classes! Till now I
> did
> something like that
> 1 - A singleton creates the DefaultHttpClient and Initialize it with some
> parameters taken from a properties file
> 2 - The singleton (manager) has some public MakeGetRequest and
> MakePostRequest (overloaded) who build the Querystring and create the
> GET/POST object
> 3 - I convert the result in a String object and send back to the caller
> Now since services are about 10 and I'd like to keep a Singleton rather
> than
> 10 objects with 10 connection pool I want make something like this ...
> MakeGetRequest(String uri, Map params, String ServiceName) 
> (for instance ServiceName can be "BANNER")
> Then I analyze the ServiceName and set the correct parameters that I
> already
> took from another property file ... 
> if ServiceName = Banner
>    Get.Port = 8080
>    Get.TimeOut = 10000
>    execute(Get)
> is it a good way?

Yes, it is. It is the recommended way of using HttpClient

>  do you have any better idea or tip? How do I set the
> parameter in a Get object?

By using HttpRequest#getParams()

Hope this helps


> Best Regards
> -- 
> - Carlo -

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

View this message in context: http://old.nabble.com/Many-services-with-different-configurations-...-tp27600241p27635624.html
Sent from the HttpClient-User mailing list archive at Nabble.com.

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

View raw message