Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

matlab.net.http.RequestLine class

Package: 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.

Construction

example

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) creates a request line by parsing str.

Input Arguments

expand all

Request line, specified as a string or 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:

Dependenttrue

Protocol version, specified as a matlab.net.http.ProtocolVersion object or a string acceptable to the constructor.

Example: 'HTTP/1.1'

Target URI, specified as a matlab.net.URI object or a string or 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'

Methods

These methods implement the equivalent 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.

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"

Introduced in R2016b

Was this topic helpful?