Package org.eclipse.jetty.client.util
Class InputStreamRequestContent
java.lang.Object
org.eclipse.jetty.client.util.AbstractRequestContent
org.eclipse.jetty.client.util.InputStreamRequestContent
- All Implemented Interfaces:
Request.Content
- Direct Known Subclasses:
ProxyServlet.ProxyInputStreamRequestContent
A Request.Content that produces content from an InputStream.
The input stream is read once and therefore fully consumed.
It is possible to specify, at the constructor, a buffer size used to read content from the stream, by default 1024 bytes.
The InputStream passed to the constructor is by default closed
when is it fully consumed.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.client.util.AbstractRequestContent
AbstractRequestContent.AbstractSubscription, AbstractRequestContent.ProducerNested classes/interfaces inherited from interface org.eclipse.jetty.client.api.Request.Content
Request.Content.Consumer, Request.Content.Subscription -
Constructor Summary
ConstructorsConstructorDescriptionInputStreamRequestContent(InputStream stream) InputStreamRequestContent(InputStream stream, int bufferSize) InputStreamRequestContent(String contentType, InputStream stream) InputStreamRequestContent(String contentType, InputStream stream, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidFails this request content, possibly failing and discarding accumulated content that was not demanded.protected Request.Content.SubscriptionnewSubscription(Request.Content.Consumer consumer, boolean emitInitialContent) protected ByteBufferonRead(byte[] buffer, int offset, int length) protected voidonReadFailure(Throwable failure) Methods inherited from class org.eclipse.jetty.client.util.AbstractRequestContent
getContentType, subscribeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.client.api.Request.Content
getLength, isReproducible
-
Constructor Details
-
InputStreamRequestContent
-
InputStreamRequestContent
-
InputStreamRequestContent
-
InputStreamRequestContent
-
-
Method Details
-
newSubscription
protected Request.Content.Subscription newSubscription(Request.Content.Consumer consumer, boolean emitInitialContent) - Specified by:
newSubscriptionin classAbstractRequestContent
-
fail
Description copied from interface:Request.ContentFails this request content, possibly failing and discarding accumulated content that was not demanded.
The failure may be notified to the consumer at a later time, when the consumer demands for content.
Typical failure: the request being aborted by user code, or idle timeouts.
- Parameters:
failure- the reason of the failure
-
onRead
-
onReadFailure
-