java.lang.Iterable<java.nio.ByteBuffer>AsyncContentProvider, ContentProvider.TypedAbstractTypedContentProvider, ByteBufferContentProvider, BytesContentProvider, DeferredContentProvider, FormContentProvider, InputStreamContentProvider, MultiPartContentProvider, OutputStreamContentProvider, PathContentProvider, StringContentProviderpublic interface ContentProvider
extends java.lang.Iterable<java.nio.ByteBuffer>
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.
| Modifier and Type | Interface | Description |
|---|---|---|
static interface |
ContentProvider.Typed |
An extension of
ContentProvider that provides a content type string
to be used as a Content-Type HTTP header in requests. |
| Modifier and Type | Method | Description |
|---|---|---|
long |
getLength() |
|
default boolean |
isReproducible() |
Whether this ContentProvider can produce exactly the same content more
than once.
|
long getLength()
default boolean isReproducible()
Whether this ContentProvider can produce exactly the same content more than once.
Implementations should return true only if the content can be
produced more than once, which means that invocations to Iterable.iterator()
must return a new, independent, iterator instance over the content.
The HttpClient implementation may use this method in particular
cases where it detects that it is safe to retry a request that failed.
Copyright © 1995–2018 Webtide. All rights reserved.