wildfly/wildfly-core — pull request #268 by bstansberry (2014-10-25 00:56:30+00:00)
Title: [WFCORE-148] Input stream response attachments

Support for attachment of input streams to management responses with:

1) Propagation to a remote ModelControllerClient over the management protocol
2) Propagation throughout the domain (e.g. server to HC to DC)
3) Ability of HTTP clients to use a query parameter (?useStreamAsResponse=0) or HTTP header ("org.wildfly.useStreamAsResponse : 0") to request the stream as the response instead of the normal JSON. In the examples above the '0' is not necessary, as it is the default.

See http://lists.jboss.org/pipermail/wildfly-dev/2014-October/003070.html

The first commit here is basically what's described above.

The second commit is concerned with cleaning up streams that the client never reads. A background task executes every 10 seconds and closes any streams associated with a particular operation if no such stream has been accessed in the past 30 seconds. This is relevant to native API requests; the HTTP handler will close all streams after responding to the client. But a native client needs to read or close the streams themselves, so a cleanup method is needed in case they fail to do so.

If a stream is read by a native client, the server-side stream is automatically closed once all bytes are sent to the client. The client does not need to close it.