matlab.net.http.io.MultipartProvider Class
Namespace: matlab.net.http.io
Superclasses: matlab.net.http.io.ContentProvider
ContentProvider to send multipart/mixed HTTP messages
Description
This provider helps with the creation of multipart HTTP messages.
The default Content-Type is "multipart/mixed"
, and the payload of the
message contains an arbitrary number of parts, each part containing its own header describing
that part. For more information on multipart messages, see RFC 2046, section 5.1 on the RFC
Editor website.
Use this provider directly only if you know that your server accepts multipart/mixed
messages. Usually, servers that accept multipart messages instead require
"multipart/form-data"
, which is implemented by the subclass
MultipartFormProvider
. You can implement other multipart types using
subclasses.
The matlab.net.http.io.MultipartProvider
class is a handle
class.
Subclass Authors
Each of the parts of the multipart message can be specified as data in any of the
formats permitted for RequestMessage.Body
, or as a
ContentProvider
that creates the data. The ContentProvider
objects that are used to supply data for the parts are called delegates, while this
MultipartProvider
is the top level provider. In general, any
ContentProvider
is suitable as a delegate. The
MultipartProvider
invokes each delegate in turn as the message is being
sent, calling its methods, such as complete
or start
, so
that the delegate in general need not be aware that it is providing content for a part,
rather than for a whole message.
This provider always transmits the RequestMessage
as chunked, so it does
not include a Content-Length header field in the message or in the headers of any of the
parts. While MultipartProvider
calls each delegate's
expectedContentLength
method before sending the part, it only uses the
return value (if nonempty) to enforce the length, not to create a Content-Length field. If
the delegate does want a Content-Length field to appear in the part, it must insert such a
field explicitly in its Header
property. None of the
ContentProvider
subclasses provided by MATLAB® do this processing.
Creation
Description
provider = MultipartProvider(
constructs a part1,...,partN
)MultipartProvider
that sends the specified parts, in the
specified order, in an HTTP request. By default this provider sets the Content-Type of the
message to "multipart/mixed"
, but subclasses can alter the subtype by
setting the Subtype
property. The constructor sets elements of the
Parts
property cell array to each
part1,...,partN
argument.
Properties
Methods
More About
Version History
Introduced in R2018a
See Also
RequestMessage
| MessageBody
| ContentProvider
| MultipartFormProvider
| MultipartConsumer