我按照this post on how to specify a timeout进行操作:
def http = new HTTPBuilder(restEndpointUrl);
http.getParams().setParameter("http.socket.timeout", new Integer(2000))
我得到了错误:
Class: groovy.lang.MissingMethodException
Message:No signature of method: groovyx.net.http.HTTPBuilder.getParams() is applicable for argument types: () values: [] Possible solutions: getParser(), getClass(), getHeaders(), getUri()
我可能将其设置在错误的类上,但是如果您直接知道我在做错什么,您的评论将不胜感激。我是Groovy / Grails的新手。
谢谢
最佳答案
您在基础客户端上设置计时器...
http.getClient().getParams().setParameter("http.socket.timeout", new Integer(2000))
关于grails - 在groovyx.net.http.HTTPBuilder上设置其他超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17730744/