且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

对于具有NTLM身份验证的http请求,使用Apache HttpComponents

更新时间:2021-11-12 17:27:22

看看错误,它在两个执行方法之间有困惑,参数。虽然我不知道为什么是...

Looking at the error, it's getting confused between two execute methods that have the same number of parameters. Although I don't know why it is...

无论如何,我发现了一个绕过错误的方法。它涉及将你之后的方法拉出类并直接调用它。如果ColdFusion对转换Java对象更满意,生活可能更容易。

Anyway, I found a way around the error. It involves pulling the method you're after out of the class and invoking it directly. If ColdFusion was happier with casting Java objects life might be easier.

//response = httpClient.execute(httpHostTarget, httpget, localContext);

classes = [httpHostTarget.getClass(), CreateObject('java', 'org.apache.http.HttpRequest').getClass(), CreateObject('java', 'org.apache.http.protocol.HttpContext').getClass()];
method = httpClient.getClass().getMethod('execute', classes);
params = [httpHostTarget, httpget, localContext];
response = method.invoke(httpClient, params);

还有另外一种方式