What's the difference between mediatype, contenttype and mimetype?
(Internet) Media Type is the proper technical term.
Content-Type is the name of the HTTP header field used to specify the media type.
MIME Type is the former name for Media Type.
Content-Type is an HTTP message header and its value is (generally) a MIME Type.
JAX-RS MediaType seems to be a Java rewrite for common MIME Types.
What is MIME Specification:
Concept of MIME (Multipurpose Internet Mail Extensions) originally was developed for organizing the structure of contents of the messages transferred over SMTP protocol. However, it's adopted in other communication protocols, such as HTTP.
So Mime, is a specification! which describes how to show the structure, format and nature of some kind of data, such as a file, or body of an email, etc.
What is Content-Type
Mime, has several header-field
s, which are used within protocols taking advantage of this specification. One of these header fields is Content-Type
. Hence, Content-Type
is not specific to HTTP protocol. A value that can be assigned to this header, is sometimes called a content type too.
There are other headers too, used for specifying the encoding of the message, or how to message should be displayed (should it be downloaded to shown or not) etc.
What is a Media Type?
Media type, formerly called mime type, is just a string. AS mentioned in MDN
It (mime type) serves the same purpose as filename extensions traditionally do on Windows
A media type, consists of a type
(such as video
) and a subtype
(such as 3gpp
). video/3gpp
is an example of media types. The list of registered media types can be seen here. In HTTP and SMTP protocols, the value of the content-type header must be a media type!
one final point:
We are not always sending just a single image file, or just some text. Sometimes our message consists of multiple parts. Not only that, but also these parts may have a nested structure. MIME is capable of showing how the parts are nested. Actually these parts can be arranged in a tree structure.
If the message has multiple parts, each part has its own Content-Type
.
media type of any non-leaf node in the tree should have multipart
type. Its subtype
can have various values based on the leaves.