Main Content

matlab.net.http.MediaType Class

Namespace: 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 on the Internet Engineering Task Force (IETF®) website. The MediaType class also represents the contents of a Content-Type field or an Accept field.

Creation

Description

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

Version History

Introduced in R2016b