What is MIME type in Servlets?

What is MIME type in Servlets?

1. What is MIME?

MIME is an abbreviation for "Multipurpose Internet Mail Extensions". At the start, email was intended to transport for textual message only and later added attachments etc. These attachments include different files of various formats like images, text files, video and audio etc. To name these extra attachments MIME was introduced. Browsers used to quote MIME types that their versions support. MIME describes the type of data the file contains.

2. What is MIME type?

A MIME type nomenclature includes a type and subtype separated by a forward slash. For example, a popular one is text/html. Here text is called type and html is known as subtype. A type may have various subtypes. A type groups files of similar nature like text/plain and text/css (Cascading Style Sheet) and text/richtext etc. List of popular MIME types is given at the end.

Sometimes, a MIME type comes with an optional character encoding also as follows as used in Servlets.

response.setContentType("text/html; charset=UTF-8");

Here, the MIME type also describes the charset to interpret the data.

Some more Definitions

  1. MIME type is an usual way of categorizing file types in Internet.
  2. The Browsers and Web servers come with a list of MIME types they support irrespective of the underlying OS.
  3. MIME is a standard set to Internet to notify the format of the file contents.
  4. MIME types are included as attribute in hyper links, object tag, scripting languages like JavaScript and CSS.
  5. MIME type tells the nature or format of file handled currently.
3. What is Internet Media Type (IMT)?

We know, the MIME types were originally developed to describe the Internet mail attachments. But later used by different technologies to inform the type of data being transported between them. For example, Servlets use MIME type (say, text/html) passed as parameter to response.setContentType("text/html") method to informs the client’s browser of how data to be interpreted or displayed that will be sent by the server. To give good meaning for the wide usage of MIME, a new word is coined as "Internet Media Type". As on today, practically both MIME and IMT are one and the same.

4. Where MIME types are used?
5. What are advantages of MIME types?
  1. Used to identify the attachments in Internet that can be transported (uploaded) with SMTP (Simple Mail Transfer Ptotocol) protocol.
  2. Web technologies use to inform the client (Browser) of data, the server is sending to client.
  3. To categorize the data files on the Web by search engines.
  4. Informs the Web browser of how the transmitted data to be encoded by the software apart standard ASCII text.
  5. Used to identify the storage for content in some specific vendor software like Lotus Domino (of IBM) and Lotus Quickr (of IBM).
6. Who is the governing body for MIME types?

The MIME types of governed by Internet Assigned Numbers Authority (IANA).

7. What the prefix x and vnd suggest for a subtype?

Some MIME types are used in public not registered with IANA. These are non-standard and sometimes specific for a particular vendor software. Examples

  1. application/x-director
    Above "director" indicates Adobe Shockwave Player file. "x" prefix indicates the subtype is not standard (not registered with IANA, Internet Assigned Numbers Authority).
  2. image/vnd.dxf
    .dxf is a file of AutoCAD. The prefix vnd indicates it is vendor specific. Another example is "application/vnd.ms-excel".
8. What is content type and how it is related to MIME?

MIME describes the content type of the data sent by a server-side Web server to a client-side Web browser. This is used in HTTP protocol supported Servlets as response.setContentType("text/html"), known as header information.

9. Give a list of most used MIME types?

application/postscript, application/msword, application/octet-stream, application/pdf, application/rtf, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/x-iphone, application/zip, audio/mpeg, audio/x-wav, image/gif, image/ief, image/jpeg, video/mpeg.

Leave a Reply

Your email address will not be published. Required fields are marked *