Main Content

delegateTo

Class: matlab.net.http.io.ContentProvider
Namespace: matlab.net.http.io

Delegate to another provider

Description

[getDataFnc,length] = delegateTo(provider,delegate,URI) sets up a delegate ContentProvider to provide all or part of the subsequent data in a RequestMessage. This method initializes properties in the delegate using properties of this object and supplied parameters, as if a new message was about to be transmitted using that delegate, and invokes the complete, expectedContentLength, and start methods in the delegate. It returns a handle to a function, getDataFnc, that you invoke to obtain data from the delegate:

[data, stop] = getDataFcn(length)

where the arguments are as described for getData. You can use any value of length, but normally you make this call in your getData method, passing the same value that was passed to your method.

To delegate to a provider that provides the entire contents of a message, call delegateTo in your start method. If you use the delegate to obtain part of the message content, then call delegateTo at the appropriate time in your putData method.

To obtain data from the delegate, always use the returned getDataFnc. Do not call the delegate's getData directly because the delegate might provide its data through some other means.

[getDataFnc,length] = delegateTo(___,force) indicates if the expectedContentLength method should return the length of the data.

Input Arguments

expand all

Content provider, specified as a matlab.net.http.io.ContentProvider object.

Provider for subsequent data, specified as a matlab.net.http.io.ContentProvider object.

Destination of the request being processed, specified as a matlab.net.URI object. The value is the URI provided to the caller's complete method.

Indicate whether the expectedContentLength method should return the length of data, specified as true or false. The delegateTo method passes this value to expectedContentLength.

Output Arguments

expand all

Function to get data from a delegate, returned as a function handle.

Value returned by the expectedContentLength method, returned as bytes. For more information, see the length output argument for ContentProvider.expectedContentLength.

Attributes

Accessprotected

Version History

Introduced in R2018a