Representation of a content type. An instance of ContentType is immutable.

Implements

Static Properties

dynamic BINARY
read-only
Content type for binary data.
dynamic HTML
read-only
Content type for HTML using UTF-8 encoding.
dynamic JSON
read-only
Content type for JSON using UTF-8 encoding.
dynamic TEXT
read-only
Content type for plain text using UTF-8 encoding.

Static Methods

parse(String value) → ContentType
Creates a new content type object from parsing a Content-Type header value. As primary type, sub type and parameter names and values are not case sensitive all these values will be converted to lower case. Parsing this string

Properties

String charset
read-only
Gets the character set.
String mimeType
read-only
Gets the mime-type, without any parameters.
Map<String,String> parameters
read-only, inherited
Gets the map of parameters.
String primaryType
read-only
Gets the primary type.
String subType
read-only
Gets the sub type.
String value
read-only, inherited
Gets the header value.

Constructors

ContentType(String primaryType, String subType, {String charset, Map<String,String> parameters})
Creates a new content type object setting the primary type and sub type. The charset and additional parameters can also be set using charset and parameters. If charset is passed and parameters contains charset as well the passed charset will override the value in parameters. Keys passed in parameters will be converted to lower case. The charset entry, whether passed as charset or in parameters, will have its value converted to lower-case.