I have strange problem with Groovy and HttpBuilder library. First to note, I’m fresh to Groovy.
I’ve based my code on tutorial. It simply loads the list of files from HTTP server. The code was working yesterday, today (after workspace build) not.
The problem is:
Caught: groovy.lang.MissingMethodException: No signature of method: groovyx.net.http.HTTPBuilder.request() is applicable for argument types: (groovyx.net.http.Method, groovyx.net.http.ContentType, pl.linfo.groovy.samples.HttpTest$_main_closure1)
Possible solutions: request(groovyx.net.http.Method, groovy.lang.Closure)
The code is:
def http = new HTTPBuilder( 'http://nbp.pl/Kursy/xml/dir.txt' )
http.request( GET, TEXT ) {
response.success = { resp, reader ->
println "${resp.statusLine}"
files = reader.text.split ('\r\n')
}
response.'404' = {
println "Not found!"
return
}
};
The running environment is Eclipse 3.6
I suppose the problem is groovy compilation issue, the groovy code fragment after recompile no longer matching Closure. However, as new to Groovy I have problem to find out what’s going on so please help.
This has to be some problem with the Eclipse Groovy plugin. The code you posted works well for me when run using the groovy interpreter.
Also the method with signature:
exists in
groovyx.net.http.HTTPBuilderclass since at least 0.3.0 version of the library.