Writing incremental computations using iteratees
There is another situation, which I haven't mentioned yet, where the server could be waiting for a remote response: when it reads the body of an incoming request. Indeed, according to the upload speed of the client, the server may be waiting between every chunk of data. In this situation, the job of the server consists of parsing the request body to make it available to the action's code. However, you don't want the server to block for the inputs to arrive, and you probably don't want the server to load the entire request body in memory, just in case it is a big file! Play provides a specific abstraction named Iteratee
for the purpose of incrementally consuming a stream of data in a non-blocking way.
Note
The iteratee's API is not intended to be used from the Java code. Nevertheless, Java developers should not skip this section as it gives useful details on the internals of Play.
An Iteratee[E, A]
object represents an incremental computation...