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.ProtocolVersion class

Package: matlab.net.http

HTTP protocol version

Description

If you use 'HTTP/1.1', you do not need to create a protocol version. To use a different protocol, use the ProtocolVersion class to create the protocol version and add it to the request line of a request message.

The server returns a ProtocolVersion object in the status line of a response message.

Construction

obj = matlab.net.http.ProtocolVersion(name,major,minor) creates the protocol version with the specified properties. This constructor enforces proper syntax of the parameters. For test purposes, create a ProtocolVersion object in a request message. Then use the isequal method to compare this value with the value returned by the server in the response message.

obj = matlab.net.http.ProtocolVersion(str) creates the version from str.

Input Arguments

expand all

Protocol version, specified as a string or a character vector acceptable to the ProtocolVersion constructor. str should have the syntax of name plus major and minor version numbers, but no error occurs if it does not.

Properties

expand all

Protocol name, specified as a string or character vector.

Example: 'HTTP'

Attributes:

Dependenttrue

Major version number, specified as an integer value from 0 through 9.

Example: 1

Attributes:

Dependenttrue

Minor version number, specified as an integer value from 0 through 9.

Example: 1

Attributes:

Dependenttrue

Methods

These methods implement the equivalent MATLAB® functionality for this class.

isequal

Uses case-insensitive compare.

char

Protocol version as character vector

string

Protocol version as string

Attributes

Sealedtrue

Examples

expand all

Send an HTTP request message to mathworks.com using default values. Display the protocol version in the response message.

request = matlab.net.http.RequestMessage;
uri = matlab.net.URI('http://www.mathworks.com');
response = send(request,uri);
version = string(response.StatusLine.ProtocolVersion)
version = 

  string

    "HTTP/1.1"

Introduced in R2016b

Was this topic helpful?