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.Producer
Nested classes/interfaces inherited from interface org.eclipse.jetty.client.api.Request.Content
Request.Content.Consumer, Request.Content.Subscription
-
Constructor Summary
ConstructorDescriptionInputStreamRequestContent
(InputStream stream) InputStreamRequestContent
(InputStream stream, int bufferSize) InputStreamRequestContent
(String contentType, InputStream stream) InputStreamRequestContent
(String contentType, InputStream stream, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Fails this request content, possibly failing and discarding accumulated content that was not demanded.protected Request.Content.Subscription
newSubscription
(Request.Content.Consumer consumer, boolean emitInitialContent) protected ByteBuffer
onRead
(byte[] buffer, int offset, int length) protected void
onReadFailure
(Throwable failure) Methods inherited from class org.eclipse.jetty.client.util.AbstractRequestContent
getContentType, subscribe
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
newSubscription
in classAbstractRequestContent
-
fail
Description copied from interface:Request.Content
Fails 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
-