posted 18 years ago
As I understand it you use the mime-mapping to set the contentType when you send a file to the browser. Say for instance you have a file that was created with a *.gif extention you send in either the file name or the .extention and the mime-type that was defined in your web.xml is returned as the content type that is returned to the browser. So for a certain extension you will always return the right content type. So then you browser will know how to render the data it has received.
// set the content type of the image data to be sent to the browser
response.setContentType(getServletConfig().getServletContext().getMimeType(file.toString()));
or response.setContentType(getServletConfig().getServletContext().getMimeType(".gif"));