我如何获取org.apache.commons.httpclient.methods.PostMethod或org.apache.commons.httpclient.HttpClient对象的底层HttpConnection?
答案 0 :(得分:0)
如果您有HttpClient
的实例,则可以使用此实例获取HttpConnection
参考:
PostMethod post = new PostMethod(url);
// ...
HttpClient httpclient = new HttpClient();
httpclient.getHttpConnectionManager().getConnection(HostConfiguration.ANY_HOST_CONFIGURATION);
// ...
httpclient.executeMethod(post);