From af3ac05806ce34d998f127682f0b843309391f31 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 25 Sep 2024 18:34:42 +0300 Subject: [PATCH] Fixes #7951 - OutputStreamContentProvider blocks forever during an HTTP2 upload after idle timeout is reached. (#12312) Improved javadocs. Signed-off-by: Simone Bordet --- .../jetty/client/OutputStreamRequestContent.java | 6 +++--- .../jetty/io/content/OutputStreamContentSource.java | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/OutputStreamRequestContent.java b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/OutputStreamRequestContent.java index f71dbe06b6f..4872397ca87 100644 --- a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/OutputStreamRequestContent.java +++ b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/OutputStreamRequestContent.java @@ -26,7 +26,7 @@ import org.eclipse.jetty.io.content.OutputStreamContentSource; *

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.

*

Example usage:

- *
+ * 
{@code
  * HttpClient httpClient = ...;
  *
  * // Use try-with-resources to autoclose the output stream.
@@ -37,7 +37,7 @@ import org.eclipse.jetty.io.content.OutputStreamContentSource;
  *             .body(content)
  *             .send(new Response.CompleteListener()
  *             {
- *                 @Override
+ *                 @Override
  *                 public void onComplete(Result result)
  *                 {
  *                     // Your logic here
@@ -50,7 +50,7 @@ import org.eclipse.jetty.io.content.OutputStreamContentSource;
  *     // Even later...
  *     output.write("more content".getBytes());
  * } // Implicit call to output.close().
- * 
+ * }
*/ public class OutputStreamRequestContent extends OutputStreamContentSource implements Request.Content { diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/OutputStreamContentSource.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/OutputStreamContentSource.java index f7a9c8429bb..1734af349d1 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/OutputStreamContentSource.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/OutputStreamContentSource.java @@ -23,12 +23,11 @@ import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.IO; /** - *

- * 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. - *

+ *

A {@link Content.Source} that provides content asynchronously through an {@link OutputStream}.

+ *

Bytes written to the {@link OutputStream} returned by {@link #getOutputStream()} + * are converted to a {@link Content.Chunk} and returned from {@link #read()}.

+ *

The {@code OutputStream} must be closed to signal that all the content has been written.

+ * * @see AsyncContent */ public class OutputStreamContentSource implements Content.Source, Closeable