matlab.net.http.RequestLine - First line of HTTP request message - MATLAB (original) (raw)
Main Content
Namespace: matlab.net.http
Superclasses: matlab.net.http.StartLine
First line of HTTP request message
Description
The RequestLine
class represents the first line of a request message. A request line is automatically created when you send or complete a message. You also can create a request line and pass it to the RequestMessage.send
method in place of the URI argument.
Creation
Description
obj = matlab.net.http.RequestLine(method,requestTarget,protocolVersion)
creates a request line with the specified properties. You can omit trailing arguments and use []
to specify any placeholders.
obj = matlab.net.http.RequestLine([str](#mw%5F133b70e7-82d6-48f3-adc3-2c83b90c7c34))
creates a request line by parsing str
.
Input Arguments
Request line, specified as a string or a character vector.str
consists of 1-3 parts, separated by white space, specifying the Method
, RequestTarget
, andProtocolVersion
properties.
Properties
Request method, specified as a matlab.net.http.RequestMethod enumeration or a string or character vector representing a request method. To send a message, set the RequestMessage.Method
property or the RequestLine.Method
property.
Example: 'GET'
Attributes:
GetAccess | public |
---|---|
SetAccess | public |
Dependent | true |
Protocol version, specified as a matlab.net.http.ProtocolVersion object or as a string acceptable to the constructor.
Example: 'HTTP/1.1'
Attributes:
GetAccess | public |
---|---|
SetAccess | public |
Dependent | true |
Target URI, specified as a matlab.net.URI object, or as a string or a character vector acceptable to the constructor. The RequestTarget
value must be consistent with the URI you specify in a request messagesend
or complete
method.
RequestTarget
contains at least a leading forward slash (/
) for the Path
property, even if the path is relative or empty.
When using a proxy, RequestTarget
is a full URI withScheme
and Authority
properties. When not using a proxy, RequestTarget
must be an absolute path with an optional Query
property. You specify a proxy in anHTTPOptions
object.
Example: 'http://heritage.stsci.edu/2007/14/images/p0714aa.jpg'
Attributes:
GetAccess | public |
---|---|
SetAccess | public |
Dependent | true |
Methods
These methods specialize standard MATLABĀ® operators and functions for objects in this class.
char | Request line as character vector |
---|---|
string | Request line as string |
Examples
Create an HTTP request line to get an image from the Hubble Heritage Project website.
import matlab.net.http.RequestLine url = 'http://heritage.stsci.edu/2007/14/images/p0714aa.jpg'; reqline = RequestLine('get',url,'HTTP/1.1'); string(reqline)
ans = "GET http://heritage.stsci.edu/2007/14/images/p0714aa.jpg HTTP/1.1"
Version History
Introduced in R2016b