Hi Oleg,

Please remember those of us who aren't using the HttpClient class right now because it isn't quite flexible enough. If all of the redirect and authentication logic is moved there, I'd also like to see more flexibility, so that we don't have to write our own client classes that duplicate all of the new code that's going into HttpClient.

In my case, the main thing I need is an override that specifies all of the execution attributes via method parameters and only uses the HttpClient instance variables for defaults. For example

  public int executeMethod(HostConfiguration hostConfiguration,
       HttpState state,
       long soTimeout,
       long httpTimeout,
       ....
       HttpMethod method)
       throws IOException, HttpException
  {
       ....
       if (state == null) { state = getState(); }
       if (soTimeout == 0) {soTimeout = this.timeoutInMilliseconds; }
       ...

This way, my HttpCache class can use the same HttpClient (and connection pool, etc.) on behalf of all of the all of its own clients, each of which passes in an HttpState object with the cookies and authentication info that it needs, the timeouts it wants for that request, etc. I remember there was another poster on the mailing list here with similar needs for a different reason. Hopefuly he'll post again, because I can't remember the exact scenario.

A couple of minor nits:

- HttpClient.isRedirectNeeded could probably be static; it doesn't depend on instance state.

- Ditto for isAuthenticationNeeded.


Otherwise the patch looks great. I agree that all of this code is "user agent" stuff that doesn't really belong down in the method classes.


-- Laura

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to