Example & Tutorial understanding programming in easy ways.

What is MIME Type and why it is used?

This is the kind of response headear which containing the basic information of data sending and reciving by the client. Mainly the “Content-Type” response header is known as MIME Type. Server sends MIME type to client to let them know the kind of data it’s sending. It helps client in rendering the data for user. Some of the mostly used mime types are text/html, text/xml, application/xml, script/text etc.

 To get the mime type of the servelets we can use ServletContext getMimeType() method to get the correct MIME type of the file and use it to set the response content type. It’s very useful in downloading file through servlet from server. 

Read More →