This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

matlab.net.http.MediaType class

Package: matlab.net.http

Internet media type used in HTTP headers

Description

The MediaType class represents an internet media type, as defined in RFC 7231 — Media Type, section 3.1.1.1. The MediaType class also represents the contents of a Content-Type field or an Accept field.

Creation

obj = matlab.net.http.MediaType(type,paramName,paramValue) creates a MediaType object given by type, with additional options specified by one or more paramName,paramValue pair arguments. You can specify several paramName,paramValue pair arguments in any order as paramName1,paramValue1,...,paramNameN,paramValueN.

obj = matlab.net.http.MediaType(text) parses text to create a media type. Quotes and escape characters within the values of parameters are removed. This constructor does not prevent creating a MediaType object with duplicate parameter names.

Input Arguments

expand all

Media type, specified as a string. The type must have the syntax of type/subtype.

Parameter name, specified as a nonempty string.

Parameter value, specified as a nonempty string or type acceptable to the string function. The string function adds quotes and escapes as needed. Do not include quotation or escape characters within paramValue.

Media type, specified as a string.

Properties

expand all

Primary type, specified as a nonempty string.

Attributes:

GetAccess

public

SetAccess

public

Data Types: string

Subtype, specified as a nonempty string.

Attributes:

GetAccess

public

SetAccess

public

Data Types: string

Parameters, specified as an nx2 string matrix. Parameters(i,1) is the name of the ith parameter and Parameters(i,2) is its value. Use the setParameter method to add or change parameter values. To reorder or remove parameters, construct a new MediaType object with the parameters you want to use from an existing MediaType object.

Attributes:

GetAccess

public

SetAccess

private

Data Types: string

Media type portion, specified as a matlab.net.http.MediaType object. MediaInfo contains the MediaType object without the parameters at or following the first q parameter.

Attributes:

GetAccess

public

SetAccess

immutable

Dependent

true

Weight parameter q, specified as double. If there is no q parameter, then Weight is empty. If the parameter cannot be converted to a double, then Weight is NaN. If you set this property, it must have a value in the range 0–1. Setting this value modifies the final q parameter in the object or adds one to the end of the parameter list.

Attributes:

GetAccess

public

SetAccess

public

Dependent

true

Methods

expand all

Introduced in R2016b