How does the timeout work in Restlet's client class?

Here's some code:

Client client = new Client(Protocol.HTTP);
client.setConnectTimeout(1); //milliseconds
Response response = client.post(url, paramRepresentation);
System.out.println("timed out");

What I would expect to happen is that it prints "timed out" before the resource has time to process. Instead, nothing happens with the timeout and it doesn't print "timed out" until after the resource returns. Even if I put a Thread.sleep(5000) at the resource that's handling the request, the entire sleep is performed, like the timeout did nothing.

Anyone have experience with this? I'm using Restlet 1.1.1. Thanks.

Answers


A few things to try:

  1. Upgrade to Restlet 1.1.5, the latest version. If this is a bug in the Client class, or in the connector you're using, it might have been fixed. (If your app isn't going to production any time soon, you might want to try the latest preview release of 2.0.)
  2. Try using a different client connector. Especially if you're using the built-in connector — it's really only intended for casual development.
  3. Try asking on the mailing list. The developers are very helpful and responsive there.

Its open source and the code is pretty clean, I've looked at it before for other things. Why not take a look?


Need Your Help

2 Identical Strings aren't matching in string length PHP

php string query-string

I'm trying to compare information from 2 different types of requests as part of my system to allow permissions to certain pages, but keep running into a string comparison issue that is boggling my ...

How to set the DataGrid's DataSource from outside?

c# wpf wpf-controls

I am developing a control in WPF, my control contains some other WPF controls such as labels, buttons and one DataGrid. So, what I have been trying to do is to create a dependency property that all...