Excel and Word previews when using Glassfish
Previews of newer Office file types, such as xlsx and docx will not work without changes to Glassfish web xml file. By default, this file is called default-web.xml.
- Edit the file in a text editor and search for xls. Copy and paste the section for xls and change ls to xlsx in the new section:
<mime-mapping>
<extension>xlsx</extension>
<mime-type>application/vnd.ms-excel</mime-type>
</mime-mapping> - Repeat the same step for doc/docx:
<mime-mapping>
<extension>docx</extension>
<mime-type>application/msword</mime-type>
</mime-mapping> - If previews for other file types are not working, add them as well.
- Save the file and restart your server.