matlab.net.http.Disposition - Results in HTTP log record - MATLAB (original) (raw)

Main Content

Namespace: matlab.net.http

Results in HTTP log record

Description

The Disposition enumeration class provides results in an HTTP log record of type matlab.net.http.logRecord.

Enumeration Member Name Description
ConversionError An error occurred converting the data of the response. The request was received, but there was an error trying to automatically convert the payload of the response. This condition indicates that the MessageBody.Payload property of LogRecord.Response contains the raw payload and theData property is empty. TheLogRecord.Exception property contains the exception.This error does not occur if a ContentConsumer was involved.
Done A request and response were successfully sent and received.Done indicates the log record contains both theRequestMessage and ResponseMessage. It does not imply anything about the StatusCode in the response.
TransmissionError An error occurred sending or receiving the message. The failure could be due to an I/O error such as a disconnect or timeout, a failure in aContentProvider or ContentConsumer, or an error trying to convert the outgoing or incoming data from or to MATLAB data. TheLogRecord.Exception property contains the exception that occurred.If the error occurred sending the request,LogRecord.Request contains the completedRequestMessage object and theLogRecord.Response property is empty.If the error occurred receiving the response, LogRecord.Response might be empty if complete headers were not received. If headers were received but the payload could not be read, then the ResponseMessage object contains the headers and might contain all or part of the payload that was received.

Version History

Introduced in R2016b

expand all

Pressing Ctrl+C while executing the MATLAB® functions in the MATLABHTTP interface stops execution of the MATLAB command. This behavior is consistent with how other MATLAB functionality handles Ctrl+C, as described in Use Keyboard Shortcuts to Navigate MATLAB.

Previously, the functions threw a custom exception that users could catch inside atry/catch block. If your code contains try/catch blocks, you can update your code by removing them.

This table shows an example of the different results when you pressCtrl+C before and starting in R2024a. This code depends on these import statements and a URI represented by <a_customer_URI>.

import matlab.net.;
import matlab.net.http.
; import matlab.net.http.field.;
import matlab.net.http.io.
;

Before After
uri = URI('<a_customer_URI>'); r = RequestMessage('GET'); try [resp, req, hist] = r.send(uri); % User presses Ctrl+C catch ME rethrow(ME); % ME contains History for the communication end K>> ME ME = HTTPException with properties: Request: [1×1 matlab.net.http.RequestMessage] URI: [1×1 matlab.net.URI] History: [1×1 matlab.net.http.LogRecord] identifier: 'MATLAB:webservices:OperationTerminatedByUser' message: 'Web service operation terminated by user while accessing URL '<a_customer_URI>'.' cause: {[1×1 MException]} stack: [5×1 struct] Correction: [] uri = URI('<a_customer_URI>'); r = RequestMessage('GET'); [resp, req, hist] = r.send(uri); % User presses Ctrl+C Operation terminated by user during matlab.internal.webservices.HTTPConnector/copyContentToByteArray

Additionally, the matlab.net.http.Disposition enumeration class no longer supports the Interrupt enumeration member. Previously,matlab.net.http.Disposition.Interrupt created an HTTP history log record matlab.net.http.LogRecord if the user interrupted a command by pressing Ctrl+C.