Special reason? It takes a stream generator is so that the stream is not created until (and unless) the request is actually executed. Also, when I was testing that method in the console without the generator, it was too easy to try to reuse a stream reference which will cause a runtime exception. The generator function makes the safer behavior explicit.
By the way if you can use File you should. The underlying apache mime library will produce a content length header for files, but it can't do that with a stream.
And finally, if you want an example of the callback listner (which is kind of neat!) it's used here to drive an upload progress meter:
On 11/8/10 11:05 AM, getagrip [via Databinder] wrote:
> I have the stream containing all data already at hand coming from a
> Subversion repository, so unfortunately I cannot use files as this
> would kill performance.
Cool. You should be able to a Content-Length header manually with <:<,
assuming you have the content length available.