Class ProxyHandler.ProxyRequestContent
- All Implemented Interfaces:
Request.Content
,Content.Source
- Enclosing class:
- ProxyHandler
-
Constructor Summary
-
Method Summary
Methods inherited from class org.eclipse.jetty.client.ContentSourceRequestContent
demand, fail, fail, getContentType, getLength, rewind
-
Constructor Details
-
ProxyRequestContent
-
-
Method Details
-
getContentSource
- Overrides:
getContentSource
in classContentSourceRequestContent
-
read
Description copied from interface:Content.Source
Reads 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.Chunk
instance 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 beenfailed
externally - a
Content.Chunk
instance, containing the chunk of content.
Once a read returns an
Content.Chunk
instance with non-nullContent.Chunk.getFailure()
then if the failure islast
further 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 callback
are 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:
read
in interfaceContent.Source
- Overrides:
read
in classContentSourceRequestContent
- Returns:
- a chunk of content, possibly a failure instance, or
null
- See Also:
-