Class RequestContentAdapter
- All Implemented Interfaces:
 EventListener,Request.Content,Request.Content.Subscription,AsyncContentProvider.Listener,Callback,Invocable
Implements the conversion from ContentProvider to Request.Content.
- 
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
Callback.Completable, Callback.Completing, Callback.NestedNested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.InvocationType, Invocable.ReadyTask, Invocable.TaskNested classes/interfaces inherited from interface org.eclipse.jetty.client.api.Request.Content
Request.Content.Consumer, Request.Content.Subscription - 
Field Summary
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoiddemand()Demands more content, which eventually results inRequest.Content.Consumer.onContent(ByteBuffer, boolean, Callback)to be invoked.voidFails this request content, possibly failing and discarding accumulated content that was not demanded.voidCallback invoked when the operation fails.longbooleanWhether this content producer can produce exactly the same content more than once.voidCallback method invoked when content is availablesubscribe(Request.Content.Consumer consumer, boolean emitInitialContent) Initializes this content producer with the content consumer, and with the indication of whether initial content, if present, must be emitted upon the initial demand of content (to support delaying the send of the request content in case ofExpect: 100-ContinuewhenemitInitialContentisfalse).voidCallback invoked when the operation completes.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.Callback
completeWith 
- 
Constructor Details
- 
RequestContentAdapter
 
 - 
 - 
Method Details
- 
getContentProvider
 - 
getContentType
- Specified by:
 getContentTypein interfaceRequest.Content- Returns:
 - the content type string such as "application/octet-stream" or "application/json;charset=UTF8", or null if no content type must be set
 
 - 
getLength
public long getLength()- Specified by:
 getLengthin interfaceRequest.Content- 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.- Specified by:
 isReproduciblein interfaceRequest.Content- Returns:
 - whether the content can be produced more than once
 
 - 
subscribe
public Request.Content.Subscription subscribe(Request.Content.Consumer consumer, boolean emitInitialContent) Description copied from interface:Request.ContentInitializes this content producer with the content consumer, and with the indication of whether initial content, if present, must be emitted upon the initial demand of content (to support delaying the send of the request content in case of
Expect: 100-ContinuewhenemitInitialContentisfalse).- Specified by:
 subscribein interfaceRequest.Content- Parameters:
 consumer- the content consumer to invoke when there is demand for contentemitInitialContent- whether to emit initial content, if present- Returns:
 - the Subscription that links this producer to the consumer
 
 - 
demand
public void demand()Description copied from interface:Request.Content.SubscriptionDemands more content, which eventually results in
Request.Content.Consumer.onContent(ByteBuffer, boolean, Callback)to be invoked.- Specified by:
 demandin interfaceRequest.Content.Subscription
 - 
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.
- Specified by:
 failin interfaceRequest.Content- Specified by:
 failin interfaceRequest.Content.Subscription- Parameters:
 failure- the reason of the failure
 - 
onContent
public void onContent()Description copied from interface:AsyncContentProvider.ListenerCallback method invoked when content is available- Specified by:
 onContentin interfaceAsyncContentProvider.Listener
 - 
succeeded
public void succeeded()Description copied from interface:CallbackCallback invoked when the operation completes.
 - 
failed
Description copied from interface:CallbackCallback invoked when the operation fails.
 - 
getInvocationType
- Specified by:
 getInvocationTypein interfaceInvocable- Returns:
 - The InvocationType of this object
 
 - 
toString
 
 -