Merged branch 'jetty-12.0.x' into 'jetty-12.1.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
commit
32156caedc
|
@ -26,7 +26,7 @@ import org.eclipse.jetty.io.content.OutputStreamContentSource;
|
||||||
* <p>Content must be provided by writing to the {@link #getOutputStream() output stream}
|
* <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>
|
* that must be {@link OutputStream#close() closed} when all content has been provided.</p>
|
||||||
* <p>Example usage:</p>
|
* <p>Example usage:</p>
|
||||||
* <pre>
|
* <pre>{@code
|
||||||
* HttpClient httpClient = ...;
|
* HttpClient httpClient = ...;
|
||||||
*
|
*
|
||||||
* // Use try-with-resources to autoclose the output stream.
|
* // Use try-with-resources to autoclose the output stream.
|
||||||
|
@ -37,7 +37,7 @@ import org.eclipse.jetty.io.content.OutputStreamContentSource;
|
||||||
* .body(content)
|
* .body(content)
|
||||||
* .send(new Response.CompleteListener()
|
* .send(new Response.CompleteListener()
|
||||||
* {
|
* {
|
||||||
* @Override
|
* @Override
|
||||||
* public void onComplete(Result result)
|
* public void onComplete(Result result)
|
||||||
* {
|
* {
|
||||||
* // Your logic here
|
* // Your logic here
|
||||||
|
@ -50,7 +50,7 @@ import org.eclipse.jetty.io.content.OutputStreamContentSource;
|
||||||
* // Even later...
|
* // Even later...
|
||||||
* output.write("more content".getBytes());
|
* output.write("more content".getBytes());
|
||||||
* } // Implicit call to output.close().
|
* } // Implicit call to output.close().
|
||||||
* </pre>
|
* }</pre>
|
||||||
*/
|
*/
|
||||||
public class OutputStreamRequestContent extends OutputStreamContentSource implements Request.Content
|
public class OutputStreamRequestContent extends OutputStreamContentSource implements Request.Content
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,12 +23,11 @@ import org.eclipse.jetty.util.FutureCallback;
|
||||||
import org.eclipse.jetty.util.IO;
|
import org.eclipse.jetty.util.IO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>A {@link Content.Source} that provides content asynchronously through an {@link OutputStream}.</p>
|
||||||
* A {@link Content.Source} backed by an {@link OutputStream}.
|
* <p>Bytes written to the {@link OutputStream} returned by {@link #getOutputStream()}
|
||||||
* Any bytes written to the {@link OutputStream} returned by {@link #getOutputStream()}
|
* are converted to a {@link Content.Chunk} and returned from {@link #read()}.</p>
|
||||||
* is converted to a {@link Content.Chunk} and returned from {@link #read()}. If
|
* <p>The {@code OutputStream} must be closed to signal that all the content has been written.</p>
|
||||||
* necessary, any {@link Runnable} passed to {@link #demand(Runnable)} is invoked.
|
*
|
||||||
* </p>
|
|
||||||
* @see AsyncContent
|
* @see AsyncContent
|
||||||
*/
|
*/
|
||||||
public class OutputStreamContentSource implements Content.Source, Closeable
|
public class OutputStreamContentSource implements Content.Source, Closeable
|
||||||
|
|
Loading…
Reference in New Issue