views:

286

answers:

2

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.

A: 

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.
Avi Flax
A: 

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

Russell Leggett