Use an HttpMethod without host information (that is, with a non-absolute URI). Then HttpClient.executeMethod will use your HostConfiguration, unmodified.
https://issues.apache.org/jira/browse/HTTPCLIENT-634 is relevant, I think. It should be fixed in the the 3.1 release, which will make it possible to use a workaround like https://issues.apache.org/jira/browse/HTTPCLIENT-640 The idea is to use a specialized HostConfiguration that keeps its Protocol when HttpClient clones it and sets the host URI. - John Kristian -----Original Message----- From: Gerry Woods [mailto:[EMAIL PROTECTED] Sent: Thursday, March 15, 2007 6:02 PM To: [email protected] Subject: HttpClient.executeMethod blows away the pased in HostConfiguration Hi, I'm new to this list so I apologise in advance if this is an inappropriate forum for this question. My issue is that I have multiple "users" talking to potentially the same HTTPS target endpoint. Because each use may have a different identity, I want to invoke HttpClient.executeMethod with my own HostConfiguration that contains my own Protocol instance that in turn has a ProtocolSocketFactory specific to the user with the appropriate credentials. I would also like to control the connection pools on a per-user basis. Unfortunately, HttpClient.exceuteMethod copies the HostConfiguration and overwrites the HttpHost if the method's URI returns true from isAbsolute. This blows away my custom ProtoclSocketFactory in favour of the one registered statically with the Protocol class. I don't understand why the code is written to copy the HostConfiguration and ignore the one that I pass in, I was hoping someone could point me in the right direction or suggest an alternative way to accomplish this. The offending (from my point of view) code in executeMethod is below: URI uri = method.getURI(); if (hostconfig == defaulthostconfig || uri.isAbsoluteURI()) { // make a deep copy of the host defaults hostconfig = new HostConfiguration(hostconfig); if (uri.isAbsoluteURI()) { hostconfig.setHost(uri); } } Thanks in advance. Gerry --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
