Interface ContentProvider

All Superinterfaces:
Iterable<ByteBuffer>
All Known Subinterfaces:
AsyncContentProvider, ContentProvider.Typed
All Known Implementing Classes:
AbstractTypedContentProvider, ByteBufferContentProvider, BytesContentProvider, DeferredContentProvider, FormContentProvider, InputStreamContentProvider, MultiPartContentProvider, OutputStreamContentProvider, PathContentProvider, StringContentProvider

@Deprecated public interface ContentProvider extends Iterable<ByteBuffer>
Deprecated.
use Request.Content instead, or toRequestContent(ContentProvider) to convert ContentProvider to Request.Content.

ContentProvider provides a source of request content.

Implementations should return an Iterator over the request content. If the request content comes from a source that needs to be closed (for example, an InputStream), then the iterator implementation class must implement Closeable and will be closed when the request is completed (either successfully or failed).

Applications should rely on utility classes such as ByteBufferContentProvider or PathContentProvider.

ContentProvider provides a length of the content it represents. If the length is positive, it typically overrides any Content-Length header set by applications; if the length is negative, it typically removes any Content-Length header set by applications, resulting in chunked content (i.e. Transfer-Encoding: chunked) being sent to the server.