Class ProxyHandler.ProxyRequestContent
- All Implemented Interfaces:
Request.Content, Content.Source
- Enclosing class:
ProxyHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface Content.Source
Content.Source.Factory -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class ContentSourceRequestContent
demand, fail, fail, getContentType, getLength, rewind
-
Constructor Details
-
ProxyRequestContent
-
-
Method Details
-
getContentSource
- Overrides:
getContentSourcein classContentSourceRequestContent
-
read
Description copied from interface:Content.SourceReads a chunk of content.
See how to use this method idiomatically.
The returned chunk could be:
null, to signal that there isn't a chunk of content available- an
Content.Chunkinstance with non nullContent.Chunk.getFailure(), to signal that there was a failure trying to produce a chunk of content, or that the content production has beenfailedexternally - a
Content.Chunkinstance, containing the chunk of content.
Once a read returns an
Content.Chunkinstance with non-nullContent.Chunk.getFailure()then if the failure islastfurther reads will continue to return the same failure chunk instance, otherwise furtherread()operations may return different non-failure chunks.Once a read returns a
last chunk, further reads will continue to return a last chunk (although the instance may be different).The content reader code must ultimately arrange for a call to
Retainable.release()on the returnedContent.Chunk.Additionally, prior to the ultimate call to
Retainable.release(), the reader code may make additional calls toRetainable.retain(), that must ultimately be matched by a correspondent number of calls toRetainable.release().Concurrent reads from different threads are not recommended, as they are inherently in a race condition.
Reads performed outside the invocation context of a
demand callbackare allowed. However, reads performed with a pending demand are inherently in a race condition (the thread that reads with the thread that invokes the demand callback).- Specified by:
readin interfaceContent.Source- Overrides:
readin classContentSourceRequestContent- Returns:
- a chunk of content, possibly a failure instance, or
null - See Also:
-