matlab.net.http.Message Class
Namespace: matlab.net.http
HTTP request or response message
Description
The Message
class is an abstract class used as a base class to create HTTP
messages.
Properties
StartLine
— First line of message
matlab.net.http.StartLine
object
First line of message, specified as a matlab.net.http.StartLine
object, if any.
Attributes:
GetAccess | public |
SetAccess | public |
Header
— Message header
[]
(default) | matlab.net.http.HeaderField
object
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 |
Body
— Message body
[]
(default) | matlab.net.http.MessageBody
object | matlab.net.http.io.ContentProvider
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 |
Completed
— Whether message is complete
false
(default) | true
Whether message is complete, specified as true
or
false
. A true
value means that the message is
complete.
RequestMessage
methods that validate messages (send
and complete
) set the Completed
property to
true
when:
The message is valid.
The processing is complete. For example, required header fields are added and the data is converted.
If the property is true, then these methods do not modify the message, and the
send
method sends the message without checking it for validity. Any
later changes to this message change the value of Completed
back to
false
.
Methods that return messages set Completed
to
true
when:
The
Body
orBody.Data
properties are empty.The
Body.Payload
property contains the raw data.
If a request message contains data (Body.Data
is not empty),
then the property is true only if Body.Payload
contains the raw
data.
In a response message, the payload is set only if you set the
HTTPOptions.SavePayload
property to
true
.
Attributes:
GetAccess | public |
SetAccess | public |
Transient | true |
Data Types: logical
Methods
Public Methods
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 |
Specialized Operators and Functions
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 |
Tips
To send arbitrary headers and data in a request message, set the
Completed
property totrue
to prevent thesend
method from modifying the message. You still can use thecomplete
method to validate the message, but thesend
method does not validate the message.
Version History
Introduced in R2016b
See Also
RequestMessage
| ResponseMessage
| MessageBody
| ContentTypeField
| HeaderField
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)