Setting timeout for Jodd HTTP client? -
i using jodd http client testing rest apis. works fine (great, actually:) except not sure how set socket time out value. sometimes, when server not up, need wait long time (because of default systems timeout big).
i using http request this:
httpresponse response = httprequest.get("http://server").query("p1", "v1")....send();
i not see timeout related method in httprequest
class.
you have 2 options here.
the first way described in docs :) anyway, thought tweak httpconnection
this:
httprequest request = httprequest.get()...; request.open(); sockethttpconnection httpconnection = (sockethttpconnection) request.httpconnection(); socket socket = httpconnection.getsocket(); socket.setsotimeout(1000); ... httpresponse response = request.send();
however, since required, added in latest version (not yet released) timeout
method, in future able set with:
httprequest.timeout(1000);
hope helps.
jodd
No comments:
Post a Comment