-
- All Superinterfaces:
java.lang.Iterable<java.nio.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 java.lang.Iterable<java.nio.ByteBuffer>Deprecated.useRequest.Contentinstead, ortoRequestContent(ContentProvider)to convert ContentProvider toRequest.Content.ContentProviderprovides a source of request content.Implementations should return an
Iteratorover the request content. If the request content comes from a source that needs to be closed (for example, anInputStream), then the iterator implementation class must implementCloseableand will be closed when the request is completed (either successfully or failed).Applications should rely on utility classes such as
ByteBufferContentProviderorPathContentProvider.ContentProviderprovides alengthof the content it represents. If the length is positive, it typically overrides anyContent-Lengthheader set by applications; if the length is negative, it typically removes anyContent-Lengthheader set by applications, resulting in chunked content (i.e.Transfer-Encoding: chunked) being sent to the server.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceContentProvider.TypedDeprecated.useRequest.Contentinstead
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description longgetLength()Deprecated.default booleanisReproducible()Deprecated.Whether this ContentProvider can produce exactly the same content more than once.static Request.ContenttoRequestContent(ContentProvider provider)Deprecated.Converts a ContentProvider to aRequest.Content.
-
-
-
Method Detail
-
toRequestContent
static Request.Content toRequestContent(ContentProvider provider)
Deprecated.Converts a ContentProvider to a
Request.Content.- Parameters:
provider- the ContentProvider to convert- Returns:
- a
Request.Contentthat wraps the ContentProvider
-
getLength
long getLength()
Deprecated.- Returns:
- the content length, if known, or -1 if the content length is unknown
-
isReproducible
default boolean isReproducible()
Deprecated.Whether this ContentProvider can produce exactly the same content more than once.
Implementations should return
trueonly if the content can be produced more than once, which means that invocations toIterable.iterator()must return a new, independent, iterator instance over the content.The
HttpClientimplementation may use this method in particular cases where it detects that it is safe to retry a request that failed.- Returns:
- whether the content can be produced more than once
-
-