Improved documentation regarding the effects of ContentProvider.getLength()

on other HTTP headers such as Content-Length.
This commit is contained in:
Simone Bordet 2015-08-24 19:20:49 +02:00
parent 545fa0f72b
commit a93b35d59e
1 changed files with 11 additions and 7 deletions

View File

@ -26,16 +26,20 @@ import org.eclipse.jetty.client.util.ByteBufferContentProvider;
import org.eclipse.jetty.client.util.PathContentProvider;
/**
* {@link ContentProvider} provides a source of request content.
* <p>
* Implementations should return an {@link Iterator} over the request content.
* <p>{@link ContentProvider} provides a source of request content.</p>
* <p>Implementations should return an {@link Iterator} over the request content.
* If the request content comes from a source that needs to be closed (for
* example, an {@link java.io.InputStream}), then the iterator implementation class
* must implement {@link Closeable} and will be closed when the request is
* completed (either successfully or failed).
* <p>
* Applications should rely on utility classes such as {@link ByteBufferContentProvider}
* or {@link PathContentProvider}.
* completed (either successfully or failed).</p>
* <p>Applications should rely on utility classes such as {@link ByteBufferContentProvider}
* or {@link PathContentProvider}.</p>
* <p>{@link ContentProvider} provides a {@link #getLength() length} of the content
* it represents.
* If the length is positive, it typically overrides any {@code Content-Length}
* header set by applications; if the length is negative, it typically removes
* any {@code Content-Length} header set by applications, resulting in chunked
* content (i.e. {@code Transfer-Encoding: chunked}) being sent to the server.</p>
*/
public interface ContentProvider extends Iterable<ByteBuffer>
{