Documentation

matlab.net.http.RequestLine class

Package:matlab.net.http
Superclasses:matlab.net.http.StartLine

First line of HTTP request message

Description

TheRequestLineclass 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 theRequestMessage.sendmethod in place of the URI argument.

Construction

example

obj = matlab.net.http.RequestLine(method,requestTarget,protocolVersion)creates a request line with the specifiedproperties. You can omit trailing arguments and use[]to specify any placeholders.

obj = matlab.net.http.RequestLine(str)creates a request line by parsingstr.

Input Arguments

expand all

Request line, specified as a string or character vector.strconsists of 1-3 parts, separated by white space, specifying theMethod,RequestTarget, andProtocolVersionproperties.

Properties

expand all

Request method, specified as amatlab.net.http.RequestMethod向量repr枚举或字符串或字符enting a request method. To send a message, set theRequestMessage.Methodproperty or theRequestLine.Methodproperty.

Example:'GET'

Attributes:

Dependent true

Protocol version, specified as amatlab.net.http.ProtocolVersionobject or a string acceptable to the constructor.

Example:'HTTP/1.1'

Target URI, specified as amatlab.net.URIobject or a string or character vector acceptable to the constructor. TheRequestTargetvalue must be consistent with the URI you specify in a request messagesendorcompletemethod.

RequestTargetcontains at least a leading forward slash (/) for thePathproperty, even if the path is relative or empty.

When using a proxy,RequestTargetis a full URI withSchemeandAuthorityproperties. When not using a proxy,RequestTargetmust be an absolute path with an optional这位yproperty. You specify a proxy in anHTTPOptionsobject.

Example:'http://heritage.stsci.edu/2007/14/images/p0714aa.jpg'

Methods

这些方法实现等效MATLAB®functionality for this class.

char

Request line as character vector

string

Request line as string

Examples

expand all

Create an HTTP request line to get an image from the Hubble Heritage Project website.

importmatlab.net.http.RequestLineurl ='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"

Introduced in R2016b

Was this topic helpful?