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

Construction

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.

Subtype, specified as a nonempty 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:

GetAccesspublic
SetAccessprivate

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:

Dependenttrue
GetAccesspublic
SetAccessimmutable

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:

Dependenttrue

Methods

getParameterValue of media type parameter
setParameterSet value of media type parameter

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

eq and isequal

Compare two MediaType objects

char

MediaType as character vector

string

MediaType as string

Introduced in R2016b

Was this topic helpful?