Skip to content

Commit

Permalink
Fixes #7951 - OutputStreamContentProvider blocks forever during an HT…
Browse files Browse the repository at this point in the history
…TP2 upload after idle timeout is reached.

Improved javadocs.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Sep 25, 2024
1 parent 04fd45d commit 0ad5906
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* <p>Content must be provided by writing to the {@link #getOutputStream() output stream}
* that must be {@link OutputStream#close() closed} when all content has been provided.</p>
* <p>Example usage:</p>
* <pre>
* <pre>{@code
* HttpClient httpClient = ...;
*
* // Use try-with-resources to autoclose the output stream.
Expand All @@ -37,7 +37,7 @@
* .body(content)
* .send(new Response.CompleteListener()
* {
* &#64;Override
* @Override
* public void onComplete(Result result)
* {
* // Your logic here
Expand All @@ -50,7 +50,7 @@
* // Even later...
* output.write("more content".getBytes());
* } // Implicit call to output.close().
* </pre>
* }</pre>
*/
public class OutputStreamRequestContent extends OutputStreamContentSource implements Request.Content
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
import org.eclipse.jetty.util.IO;

/**
* <p>
* A {@link Content.Source} backed by an {@link OutputStream}.
* Any bytes written to the {@link OutputStream} returned by {@link #getOutputStream()}
* is converted to a {@link Content.Chunk} and returned from {@link #read()}. If
* necessary, any {@link Runnable} passed to {@link #demand(Runnable)} is invoked.
* </p>
* <p>A {@link Content.Source} that provides content asynchronously through an {@link OutputStream}.</p>
* <p>Bytes written to the {@link OutputStream} returned by {@link #getOutputStream()}
* are converted to a {@link Content.Chunk} and returned from {@link #read()}.</p>
* <p>The {@code OutputStream} must be closed to signal that all the content has been written.</p>
*
* @see AsyncContent
*/
public class OutputStreamContentSource implements Content.Source, Closeable
Expand Down

0 comments on commit 0ad5906

Please sign in to comment.