playframework/Play20 — pull request #638 by gre (2012-12-30 18:37:07+00:00)
Title: WS: Split ConnectionTimeout and RequestTimeout properties

Today we can define a "timeout" in a WS request. We can use it both with the configuration `"ws.timeout"` and with `WS.url(..).withTimeout(timeout)`. The default timeout is set to 120 seconds.

Unfortunately, in the current implementation, this timeout determines both the time to wait before the remote host to respond (ConnectionTimeout) and the maximum time we accept to consuming a response (RequestTimeout).

However, in [AsyncHttpClientConfig.Builder](http://www.jarvana.com/jarvana/view/com/ning/async-http-client/1.0.0/async-http-client-1.0.0-javadoc.jar!/com/ning/http/client/AsyncHttpClientConfig.Builder.html), there are `setConnectionTimeoutInMs` and `setRequestTimeoutInMs`.

And IMHO those are totally different.

This pull request propose to split these 2 different properties.

ConnectionTimeout => "ws.timeout" as before to keep compatibility (it is what we except a timeout to be: the time the request can wait when connecting to a remote host)

RequestTimeout => "ws.timeout.request" which is set to "-1" to make it "Infinite" by default.
IHMO, and especially for Play 2, it doesn't make sense to interrupt a WS consumption after 120 seconds. You except to consume a stream forever (see for instance the Twitter example, any stream example would have this issue btw).