Main Content

matlab.net.http.RequestLine Class

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.

Class Attributes

Sealed
true

For information on class attributes, see Class Attributes.

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.

example

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

Input Arguments

expand all

Request line, specified as a string or a character vector. str consists of 1-3 parts, separated by white space, specifying the Method, RequestTarget, and ProtocolVersion properties.

Properties

expand all

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 message send 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 with Scheme and Authority properties. When not using a proxy, RequestTarget must be an absolute path with an optional Query property. You specify a proxy in an HTTPOptions object.

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

Attributes:

GetAccess
public
SetAccess
public
Dependent
true

Methods

expand all

Examples

collapse all

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