Using Apache HttpComponents for http requests with NTLM authentication

穿精又带淫゛_ 提交于 2019-12-04 13:45:31

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...

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);

There may be another way of doing this (casting instead) but it's all I've got ;)

As a guess, could you be loading the wrong version of the .jars ? You don't seem to be using JavaLoader like Ryan did...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!