Servlet Content Type
Advertisements
Content Type in Servlet
Content Type is also known as MIME Type. MIME stand for Multipurpose internet Mail Extension. It is a HTTP header that provides the description about what are you sending to the browser (like send image, text, video etc.).
This is the format of http protocol to carry the response contains to the client..
Example: Suppose you send html text based file as a response to the client the MIME type specification is
Syntax
response.setcontentType("text/html");
MIME type have two parts, They are:
- Base name
- Extension name
Base name: It is the generic name of file.
Extension name: It is extension name for specific file type.
The supporting MIME type by http protocol are:
File | MIME Type | Extension |
---|---|---|
xml | text/xml. | .xml. |
HTML | text/html. | .html. |
Plaintext File | text/plain. | .txt. |
application/pdf. | .pdf. | |
gif Image | image/gif. | .gif. |
JPEG Image | image/jpeg. | .jpeg. |
PNG Image | image/x-png. | .png. |
MP3 Music File | audio/mpeg. | .mp3. |
MS Word Document | application/msword. | .doc. |
Excel work sheet | application/vnd.ms-sheet. | .xls. |
Power Point Document | application/vnd.ms-powerpoint. | .ppt. |
Google Advertisment