Hi all, I am opening a new mail thread related to the following one "HTTP connection leak and other related issues" [1]. Since this became really long and hairy discussion I decided not to post there this mail.
The use case I want to point out a concrete use case I have. I want to reuse a HttpClient among different instances of a clients which are executed in different threads. Every client can make several invocations. The clients can call different Web Services (WSs) deployed at different hosts/servers. As a consequence every client may need to provide different authentication Credentials and may need to support transport sessions using Cookies. Both Credentials and Cookies are part of the HttpState. As a result the HttpState associated with the HttpClient that is reused cannot be reused that easily in the scenario described in the above lines. Credentials are associated with a given host, port, realm and authentication schema (defines the AuthScope object used as a key for the credentials Map part of the HttpState). Following is an excerpt from the AbstractHTTPSender#setAuthenticationInfo: creds = new UsernamePasswordCredentials(username, password); agent.getState().setCredentials(new AuthScope(host, port, realm), creds); Credentials are kept into a Map and could be indentified uniquely from client to client (thread to thread), but this Map is exposed to all clients which reuse the HttpClient which is not a good idea. The situation with the other member of the HttpState (i.e. Cookies) is similar. When we have to *different* instances of a client (configured to use cookies options.setManageSession(true)) calling one and the same WS's operation then the effect is that both are sharing one JSESSIONID. The proposal The proposal is based on my question posted at httpclient-us...@hc.apache.org [2] The idea is to provide the capability to specify/associate a separate HttpState with every client and still reuse one and the same HttpClient. What you just need is to pass it as a parameter to the HttpClient#executeMethod. I decided that the HttpState should be kept into the ServiceContext. I did all changes needed in Axis2 kernel (in fact they are really few) and added the possibility to use a separate HttpState and invoke HttpClient#executeMethod passing it as a parameter. The changes keep the kernel backward compatible. I did and several tests and it looks good. Please, give me your comments. Do you like this extension? If so I can provide you with the changes and finally we can agree on committing them into the kernel. Thank you, Dobri [1] http://www.mail-archive.com/axis-dev@ws.apache.org/msg45787.html [2] http://www.mail-archive.com/httpclient-us...@hc.apache.org/msg01944.html