Package org.eclipse.jetty.client.util
Class ByteBufferRequestContent
java.lang.Object
org.eclipse.jetty.client.util.AbstractRequestContent
org.eclipse.jetty.client.util.ByteBufferRequestContent
- All Implemented Interfaces:
Request.Content
A Request.Content for ByteBuffers.
The position and limit of the ByteBuffers passed to the constructor are not modified;
content production returns a slice of the original ByteBuffer.
-
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
ConstructorsConstructorDescriptionByteBufferRequestContent(String contentType, ByteBuffer... buffers) ByteBufferRequestContent(ByteBuffer... buffers) -
Method Summary
Modifier and TypeMethodDescriptionlongbooleanWhether this content producer can produce exactly the same content more than once.protected Request.Content.SubscriptionnewSubscription(Request.Content.Consumer consumer, boolean emitInitialContent) 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
fail
-
Constructor Details
-
ByteBufferRequestContent
-
ByteBufferRequestContent
-
-
Method Details
-
getLength
public long getLength()- Returns:
- the content length, if known, or -1 if the content length is unknown
-
isReproducible
public boolean isReproducible()Description copied from interface:Request.ContentWhether this content producer can produce exactly the same content more than once.
Implementations should return
trueonly if the content can be produced more than once, which means thatRequest.Content.subscribe(Consumer, boolean)may be called again.The
HttpClientimplementation may use this method in particular cases where it detects that it is safe to retry a request that failed.- Returns:
- whether the content can be produced more than once
-
newSubscription
protected Request.Content.Subscription newSubscription(Request.Content.Consumer consumer, boolean emitInitialContent) - Specified by:
newSubscriptionin classAbstractRequestContent
-