06 Juli 2006

Bug in handling .wmv files by Tomcat 5

Tomcat is often used as web server for executing Java Server Pages. In Tomcat 5 there is a problem in handling video files.

If there is a link in a web page to a video of type Windows Media Video (.wmv), there is a problem to run this video. First the Mime type is not known by Tomcat. You can add the correct Mime type in the file web.xml in folder conf.

<mime-mapping>
    <extension>wmv</extension>
    <mime-type>video/x-ms-wmv</mime-type>
</mime-mapping>

The Mime type is known after restarting Tomcat, nevertheless the file is not handled correctly. By example I could view the video using Internet Explorer, but not using Firefox. This is very annoying, because I hate web pages 'best and only viewed by my preferred browser'.

But there is a solution for this bug. Change the Mime type to the following (incorrect) setting:

<mime-mapping>
    <extension>wmv</extension>
    <mime-type>application/octet-stream</mime-type>
</mime-mapping>

Firefox will ask to download the file and Internet Explorer directly starts the movie. The fame for this solution does not due to me, it was posted by Patrick Willart in a mailing list.

Keine Kommentare: