|
In HttpClient 2.0 API HttpMethod interface represents both request and response,
which effectively implies one to one relationship between a request and a response. Unfortunately this is not always true. For instance, HTTP proxy tunneling requires a CONNECT method to be executed against the server before the original HTTP method can be executed against the target server. Should the CONNECT method fail (due to authorization error, for instance), its response should be returned as if it was a response to the original HTTP method. This is currently not possible due to the monolithic design of HttpMethod interface. The problem has been worked around by providing a method to copy the response content (status line, response headers and response body) from one method onto another. A better, more elegant solution requires HttpMethod interface be split into HttpREquest / HttpResponse pair of interfaces the proxy method does not work either when creating a
new HttpClient(new MultiThreadedHttpConnectionManager()); *tried 2.0 and 3.0-alpha2* Kees, what exactly do you mean by a "proxy method"? Please consider providing
sample code and the wire/debug trace http://jakarta.apache.org/commons/httpclient/troubleshooting.html Oleg |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
solution does not appear possible without a significant redesign. Possible
solution would be to split monolithic HttpMethod interface into a pair of
HttpRequest/HttpResponse interfaces, which would allow executing extra requests
(such as CONNECT request or GET request in response to POST request redirect)
behind the scene and returning the resultant response to the caller.
Oleg