matlab.net.http.ResponseMessage Class
Namespace: matlab.net.http
Superclasses: matlab.net.http.Message
HTTP response message
Description
The ResponseMessage class formats HTTP response messages returned by a
server.
Creation
The RequestMessage.send method creates a response message.
Properties
Status line from server, specified as a matlab.net.http.StatusLine object.
Attributes:
GetAccess | public |
SetAccess | public |
Dependent | true |
HTTP status code, specified as a matlab.net.http.StatusCode object. Same as the
StatusLine.StatusCode property.
Attributes:
GetAccess | public |
SetAccess | immutable |
Dependent | true |
Message header, specified as a matlab.net.http.HeaderField object or
a vector of HeaderField objects. When you set the
Header property, MATLAB® checks the fields of the header to ensure that they are appropriate for
the message type. The RequestMessage
send and complete methods fill in any required header
fields for a properly formed request.
Attributes:
GetAccess | public |
SetAccess | public |
Message body, specified as a matlab.net.http.MessageBody object,
matlab.net.http.io.ContentProvider, or data acceptable to the
MessageBody constructor. By default, Body is
empty (set to []). A request message containing a
Body property must use a method such as
'PUT' or 'POST', not the default value
'GET'.
In a completed or received message, if the message has a ContentTypeField header field, then the MessageBody.ContentType property is set to that value. Otherwise, ContentType is unchanged or empty.
Attributes:
GetAccess | public |
SetAccess | public |
Whether message is completed, specified as true or
false. A true value means that the message was
completed. Methods that return messages set the Completed property
to true when:
The
BodyorBody.Dataproperties are empty.The
Body.Payloadproperty contains the raw data.
Attributes:
GetAccess | public |
SetAccess | public |
Transient | true |
Data Types: logical
Methods
complete | Process or reprocess response payload Content-Type |
addFields | Add fields to message header |
changeFields | Change existing fields in message header |
getFields | Return message header fields matching name or class |
removeFields | Remove fields from message header |
replaceFields | Change values in or add fields to message header |
show | Display or return formatted version of message |
These methods specialize standard MATLAB operators and functions for objects in this class.
string | Message If The string is an approximate representation of what the message looks like when sent or received. Use for logging, diagnostics, or debugging. For
a formatted version of messages, use |
char | Same as |
isequal | Returns |
Examples
Send a message to the Hubble Heritage website requesting an image of Jupiter.
Format an HTTP request message and display the Content-Type of the response message body. The server returns a JPEG image.
request = matlab.net.http.RequestMessage;
uri = matlab.net.URI('http://heritage.stsci.edu/2007/14/images/p0714aa.jpg');
r = send(request,uri);
r.Body.ContentType
ans =
MediaType with properties:
Type: "image"
Subtype: "jpeg"
Parameters: []
MediaInfo: "image/jpeg"
Weight: []
Display the image using the imshow function. MATLAB resizes the image to fit on the screen.
warning('off','Images:initSize:adjustingMag'); imshow(r.Body.Data)

Version History
Introduced in R2016b
See Also
RequestMessage | send | StatusLine | StatusCode | MessageBody
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)