Wednesday, October 24, 2012

Easy way to find out Mime Type details


How to know about the different Mime Types details.

Whenever we start writing code inside servlet very often we come across some general setting like…

PrintWriter pw=response.getWriter();
and
response.setContentType("text/html");

if we specifically talk about setContentType(-), this method indicates, In what kind of format ,data should be printed on browser by default it prints in html format.

But the Question is how can we know what all mime types are there and how do we gather it.

By seeing java notes or by googling it .....Ofcourse, But its lengthy process!!!


Here is the easiest way ...

its very simple we can find it in just 3 steps ,nothing more.....


Step1) press window key+R

 you'll get Run prompt there you type "regedit" and then ok





for better visibility of image click on it.

***********************************************************************

Step2)Registry editor will be opened...

Here you have to click on "HKEY_CLASSES_ROOT"




************************************************************************

step3) Now Scroll Down, look for the extension you want click

on that you will get mime type




************************************************************************

now copy and paste in setContentType("application/msword")


That's how you can find mime type for any format

Don't need to remember all mime types.

No comments:

Post a Comment