Progress monitor for HTTP message exchange
ProgressMonitor class to implement a
progress monitor for an HTTP request message. A progress monitor listens
to changes in the properties of this class to implement a display
or update of your choice.
To implement a progress monitor, create a subclass of this class.
Then create an
HTTPOptions object, specify that subclass
ProgressMonitorFcn property, and set the
An HTTP request starts when you call the
The process might involve multiple messages in both directions in
the case of redirects and authentication. MATLAB® calls the
when all transfers have been completed.
During a transfer:
MATLAB sets the
Direction properties when you call
MATLAB sets the
repeatedly as the body of the request message is sent to indicate
the number of bytes transferred.
When receipt of the
ResponseMessage begins, MATLAB sets
To cancel the transfer at any time, call the
This action is the same as interrupting the
in the Command Window.
You can display a graphical progress indicator or other indication
of progress after
Direction changes to
Value, update the indicator to
Value. You can also use this mechanism
to monitor progress programmatically.
obj = matlab.net.http.ProgressMonitor(Name,Value) creates
a progress monitor with
additional properties specified by one, or more name-value pair arguments.
the property name and
Value is the corresponding
value. You can specify several name-value pair arguments in any order
Name1,Value1,...,NameN,ValueN. Unspecified properties
are set to their default values.
Interval— Seconds to first call and maximum interval between calls
Seconds to first call and maximum interval between calls, specified as double.
Interval is the amount of time in seconds
after the start of transfer before the first setting of the
a suggested maximum amount of time between settings of
regardless of progress. If the total time to transfer the data is
Interval seconds, then
not set. If no data has been transferred in
since the last setting of
be set again to the same value. In this way, your
can cancel a transfer (by calling
even if there is no progress.
Interval value is a suggested value.
There is no guarantee that MATLAB sets
if there has been no progress.
The default interval is two seconds. To specify a different
Interval in your constructor. The
minimum interval between consecutive settings of
there is no progress is 0.1 seconds. However, if
it might be set more often than this interval.
Value the first time, there
is no delay in setting
Value for subsequent messages
in the same exchange.
InUse— Monitor is in use indicator (read-only)
Monitor is in use indicator, specified as
false. MATLAB sets
this property to indicate whether it is using this
during a transfer.
InUse prevents you from reusing
this object for more than one transfer at a time.
CancelFcn— Function to call to cancel transfer (read-only)
Function to call to cancel a transfer, specified as a function
handle. MATLAB sets
CancelFcn to the function
ProgressMonitor should call to cancel a transfer.
Calling this function has the same effect as interrupting the transfer
in the Command Window.
Max— Maximum length of the transfer (read-only)
Maximum length of the transfer, specified as
If the maximum length is not known,
the maximum value for your displayed progress indicator.
Max at the beginning of
each send and receive operation to the expected number of bytes to
be transferred, based on the Content-Length header field.
If the message does not contain a Content-Length field,
In this case, you cannot determine the proportion of the transfer
that has been completed. You can, however, still monitor changes in
Direction— Direction of transfer
matlab.net.http.MessageTypeobject | empty
Direction of transfer, specified as a
matlab.net.http.MessageType object. MATLAB sets
indicate whether progress is monitored for a request message or a
response message. If no transfer is taking place, then
Value— Number of bytes transferred so far
Number of bytes transferred so far, specified as
uint64. MATLAB sets
to the total number of bytes transferred for the current message.
However, it delays setting this property the first time in an exchange
until at least
Interval seconds have elapsed
since the start of the message.
set.Value method for this property
to monitor progress of the transfer. You can also implement the ability
to cancel the transfer from within the progress monitor in the
MATLAB might set
Value to empty at
the end of a given transfer, to indicate that transfer in the current
direction has ended. MATLAB always sets
empty at the conclusion of all transfers before calling the
You cannot control the frequency at which MATLAB updates
Value property. However, MATLAB might
Value at least once every
even if there is no progress. This behavior allows you to call the
a transfer is not progressing.
Value might be
zero if no bytes have been transferred for
since transfer began.
|done||Indicate all message transfers completed|
Handle. To learn how handle classes affect copy operations, see Copying Objects.