Groovy 带有闭包参数的HTTPBuilder get方法返回MissingMethodException
以下代码:Groovy 带有闭包参数的HTTPBuilder get方法返回MissingMethodException,groovy,httpbuilder,missingmethodexception,Groovy,Httpbuilder,Missingmethodexception,以下代码: def http = new HTTPBuilder( 'http://twitter.com/statuses/' ) http.get( path: 'user_timeline.json', query: [id:'httpbuilder', count:5] ) { resp, json -> println resp.status json.each { // iterate over JSON 'status' object in
def http = new HTTPBuilder( 'http://twitter.com/statuses/' )
http.get( path: 'user_timeline.json',
query: [id:'httpbuilder', count:5] ) { resp, json ->
println resp.status
json.each { // iterate over JSON 'status' object in the response:
println it.created_at
println ' ' + it.text
}
}
为什么会有例外?我使用了来自的相同代码,应该可以工作。这是IDE的问题,Eclipse groovy插件不太好。这是IDE的问题,Eclipse groovy插件不太好。对我来说很好;你正在使用什么版本的东西?另外,堆栈跟踪/某些上下文也很有用。我认为这可能是我的IDE的问题,我使用的是Spring工具套件2.6。例外信息是,它找不到方法public Object get(Map args,Closure responseClosure)适合我;你正在使用什么版本的东西?另外,堆栈跟踪/某些上下文也很有用。我认为这可能是我的IDE的问题,我使用的是Spring工具套件2.6。异常信息是它找不到方法public Object get(Map args、Closure responseClosure)