hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronald Klop <ronald-mailingl...@base.nl>
Subject proxy and howto's and some questions.
Date Tue, 18 Feb 2003 11:56:35 GMT
Hello,

Are there any howto's about the usage of this package? I can only find 
the API, but some examples are always more clear.

And why aren't the proxy settings not used by the package?
I now made this method to create the HostConfiguration, but it would be 
nice if it's in the package automaticly.

	private static HostConfiguration getHostConfiguration(
			String host, String protocol) {
		String propNameHost = "proxyHost";
		String propNamePort = "proxyPort";

		String proxyHost =
			System.getProperty(protocol+"."+propNameHost);
		Integer proxyPortInt =
			Integer.getInteger(protocol+"."+propNameHost);

		if(proxyHost == null && proxyPortInt == null) {
			// Fall back if the properties do not exist.
			proxyHost = System.getProperty(propNameHost);
			proxyPortInt = Integer.getInteger(propNamePort);
		}

		HostConfiguration config = new HostConfiguration();
		config.setHost(host, -1, protocol); // Use default port.

		if (proxyHost != null && proxyPortInt != null) {
			int proxyPort = proxyPortInt.intValue();
			config.setProxy(proxyHost, proxyPort);
		}

		return config;
	}

And is it needed to make a HostConfiguration by hand?
Can't I just do:
HttpClient hc = new HttpClient();
hc.executeMethod("http://bla1.bla/bla/bla");
hc.executeMethod("http://bla2.bla/bla/bla");
hc.executeMethod("http://bla3.bla/bla/bla");

And that the HostConfiguration is used internaly in HttpClient in stead 
of made by me.
I now have to do the bookkeeping of all the hosts I connect with myself 
and it would be nice if that is all handled automaticly by httpClient.
Just my to cents.

I'm willing to write some code for this, but I don't wont to change the 
API, if other developers don't agree with it.

Greetings,

Ronald.



Mime
View raw message