matlab.net.http.MediaType - Internet media type used in HTTP headers - MATLAB (original) (raw)

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 RFC Editor 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](#mw%5F4f860baf-9c9c-419a-a4e2-78eced986361),[paramName](#mw%5F011ba817-9d66-4da5-9177-ac7be16463a9),[paramValue](#mw%5F5e86ee01-92c5-4c45-b636-4c0e0ce08716)) creates a MediaType object given by type, with additional options specified by one or moreparamName,paramValue pair arguments. You can specify several paramName,paramValue pair arguments in any order asparamName1,paramValue1,...,paramNameN,paramValueN.

obj = matlab.net.http.MediaType([text](#mw%5F12f56833-829c-4562-824b-7642c5b556f6)) parsestext to create a media type. Quotes and escape characters within the values of parameters are removed. This constructor does not prevent creating aMediaType object with duplicate parameter names.

Input Arguments

expand all

type — Media type

string

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

paramName — Parameter name

string

Parameter name, specified as a nonempty string.

paramValue — Parameter value

string | type acceptable to the string function

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

text — Media type

string

Media type, specified as a string.

Properties

expand all

Type — Primary type

string

Primary type, specified as a nonempty string.

Attributes:

GetAccess public
SetAccess public

Data Types: string

Subtype — Subtype

string

Subtype, specified as a nonempty string.

Attributes:

GetAccess public
SetAccess public

Data Types: string

Parameters — Parameters

nx2 string matrix

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 existingMediaType object.

Attributes:

GetAccess public
SetAccess private

Data Types: string

MediaInfo — Media type portion

matlab.net.http.MediaType object

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 — Weight parameter q

double | empty | NaN

Weight parameter q, specified as double. If there is noq 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

Public Methods

Specialized Operators and Functions

These methods specialize standard MATLAB® operators and functions for objects in this class.

eq Element by element comparisons between two MediaType arrays, returned as a logical array of the same dimensions. If the arrays are not the same dimensions, one must be a scalar, and then scalar-expansion is used.Two MediaType arrays are considered equal if they have the same Type and Subtype properties using a case-insensitive comparison. In addition, they have the sameParameters property names and values, where parameter names are case-insensitive and values are case-sensitive, except for 'charset' values, as described in RFC 2046 Charset Parameter, section 4.1.2. Parameter order is not significant.
isequal Compare two MediaType arrays with same dimensions and corresponding elements according to eq
string MediaType as string
char MediaType as character vector

Version History

Introduced in R2016b