Created
June 16, 2013 08:03
-
-
Save Leegorous/5791336 to your computer and use it in GitHub Desktop.
If there are some requests you don't want to wait, just set the socket & connection timeout & no retry on error. Restlet 设置连接超时的方法。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context ctx = new Context(); | |
ctx.getParameters().add("socketTimeout", "200"); // http.socket.timeout | |
ctx.getParameters().add("socketConnectTimeoutMs", "100"); // http.connection.timeout | |
ClientResource client = new ClientResource(uri); | |
client.setNext(new Client(ctx, Protocol.HTTP)); | |
client.setRetryOnError(false); | |
Representation entity = client.get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment