0

我将如何获取 org.apache.commons.httpclient.methods.PostMethod 或 org.apache.commons.httpclient.HttpClient 对象的底层 HttpConnection?

4

1 回答 1

0

如果您有一个实例,HttpClient则可以使用它来获取HttpConnection参考:

    PostMethod post = new PostMethod(url);
    // ...
    HttpClient httpclient = new HttpClient();  
    httpclient.getHttpConnectionManager().getConnection(HostConfiguration.ANY_HOST_CONFIGURATION);
    // ...
    httpclient.executeMethod(post);
于 2013-07-17T08:32:50.290 回答