Main Content

matlab.net.http.field.GenericParameterizedField Class

Namespace: matlab.net.http.field
Superclasses: matlab.net.http.field.GenericField

GenericField to support parameterized syntax

Description

A GenericParameterizedField object is a version of a GenericField object that supports the following parameterized syntax.

Type; param1=value1; param2=value2; param3=value3; ...

Type is a token and each param=value pair represents the name and value of a parameter. Type is optional, though subclasses can require it. Unlike GenericField, this field only supports a single set of parameters (collectively called an "element"), not a comma-separated list of elements.

Creation

Description

obj = GenericParameterizedField(name,value) creates an HTTP header field with the Name property set to name and the Value property set to value. If value is a string or character vector, then value is used as is. Otherwise, MATLAB® attempts to convert it to a string.

value should contain a type and semicolon-separated list of parameters in the following form, where type is the value of the Type property and each param=value defines a parameter. However, MATLAB does not enforce this syntax of value.

type; param1=value1; param2=value2; param3=value3; ...

If value is an Nx2 string matrix, each row of the matrix represents a param=value parameter of the field, in the form:

""     type
param1 value1
param2 value2

Any row with an empty name appears in the field as a value without a name. Normally the first row is the Type. When using this form of the constructor, MATLAB checks that the param names and the type are legal tokens. For param=value pairs, MATLAB quotes values that contain reserved characters, if they are not already quoted, and escapes double-quotes.

The type is optional. If not set, then it can be set later using the Type property or by calling the method setParameter(obj,"",type).

obj = GenericParameterizedField(name,type,Name,Value) creates a header field with the Type property set to type and parameters with additional options specified by one or more Name,Value pair arguments.

This syntax is roughly the same as specifying the following string matrix argument:

obj = GenericParameterizedField(NAME, ["" TYPE; PARAM1 VALUE1; PARAM2 VALUE2; ...])

Properties

expand all

Field Type property specified as a string. The value is equal to any token in the field's value that is not part of a name=value pair. If there is more than one, then Type is a string array containing all such tokens. There is normally one token at the start of the value that is considered the type of the value.

For example, in the following statement, the Type property is MYTYPE.

MYTYPE; foo=bar; abc=def; hij=klm

In the following statement, there is no Type, so the Type property is "".

foo=bar; abc=def; hij=klm

To remove all tokens, set Type to an empty array or an empty string.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true

Field name specified as a string or character vector. This property is inherited from superclass matlab.net.http.HeaderField.

Attributes:

GetAccess
public
SetAccess
public

Field value specified as a string or any type valid for the Name property. This property is inherited from superclass matlab.net.http.HeaderField.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true

Methods

expand all

Version History

Introduced in R2018a