DescriptionThis CL adds new stream-based APIs for getting content from and setting content to a MutableContent object, and extends this to the intended primary use, creation of HttpResponse objects.
It extends byte[]-mutation APIs by adding an internal wrapper around the byte array; however, no existing method's semantics are modified by this change, the wrapper providing a layer of indirection.
When using streaming-set/get APIs, the key limitation is put in place that a content stream may only be retrieved once. This (simplified) policy ensures that streaming content is accessed in a clear fashion. As well, when generating an HttpResponse from a content stream, byte[]-based content encoding detection is not supported. Adherence to these policies is intended, with this design approach (as opposed to building a completely parallel streaming pipeline), to be a function of wiring/configuration: proxies/rewriters that require streaming must *all* use streaming APIs.
The implementation allows a streaming-set operation to later be compatible with buffered-read operations. In other words, setContentStream(InputStream) is functionally equivalent to setContentBytes(byte[]), with the former buffering all content before supporting existing operations. A direct consequence is that HttpFetcher implementations may now be "streaming-type" without having to modify any existing rewriter logic.
The intent of this CL is to roll out support for streaming fetch operations in Shindig slowly:
1. As noted, allows HttpFetcher implementations to be streaming-type now.
2. Provides basis for streaming (pass-through) proxy support with little effort.
3. Provides basis for streaming rewrites (depending on type, will require additional work such as streaming parser).
Sending CL for design review before augmenting tests enforcing streaming policy.
Patch Set 1 #Patch Set 2 : Fixed patch. #
Total comments: 4
Patch Set 3 : Accommodate Ziv's comments. Lazy-detect encoding (still w/ header-set). #
Total comments: 3
MessagesTotal messages: 7
|
||||||||||||||||||||||||||||||||||||||||||||||