hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Kristian" <jkrist...@netflix.com>
Subject RE: HttpClient.executeMethod blows away the pased in HostConfiguration
Date Fri, 16 Mar 2007 04:31:32 GMT
Use an HttpMethod without host information (that is, with a non-absolute
URI).  Then HttpClient.executeMethod will use your HostConfiguration,

is relevant, I think.  It should be fixed in the the 3.1 release, which
will make it possible to use a workaround like
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:gerry.woods@soa.com] 
Sent: Thursday, March 15, 2007 6:02 PM
To: httpcomponents-dev@jakarta.apache.org
Subject: HttpClient.executeMethod blows away the pased in


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()) {





Thanks in advance.


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

View raw message