1.) Add the mime type to the the domain’s default-web.xml (ex. domains/domain1/config/default-web.xml)
2.) Restart the domain
3.) Redeploy the web application where the file related to the new mime type is being served.
Sound simple? It is simple! But it took me a week to figure this out! The documentation is flaky on this subject. First, I just tried the Help in the Admin Console. I searched mime. Nothing. So I tried the documentation. In the Developer’s Guide, I found this:
Using the default-web.xml File
You can use the default-web.xml file to define features such as filters and security constraints that apply to all web applications.
The mime-mapping elements in default-web.xml are global and inherited by all web applications. You can override these mappings or define your own using mime-mapping elements in your web application’s web.xml file. For more information about mime-mapping elements, see the Servlet specification.
You can use the Admin Console to edit the default-web.xml file. For details, click the Help button in the Admin Console. As an alternative, you can edit the file directly using the following steps.
To Use the default-web.xml File
- Place the JAR file for the filter, security constraint, or other feature in the domain-dir/lib directory.
- Edit the domain-dir/config/default-web.xml file to refer to the JAR file.
- Restart the server.
From this, I gathered 2 important facts:
1.) I can add a global mime type to default-web.xml
2.) I will probably need to start the server
On the glassfish forum, I gathered that for default-web.xml changes to take effect, the application that needs them requires a redeployment. Great! No problem…didn’t work.I was overlooking a small detail. I redeployed the wrong application. I redeployed that application that links to the file I was miming, instead of the application that actually contains the file: the “/” application that serves the purpose of document root. Once I redeployed “/”, it all worked fine.
It worked for .pps file extension
pps application/powerpoint
Thank you
Hobi
The force must be strong with you, friend
David,
I’m a tech writer on NetBeans at Sun, covering web services. I want to create a tutorial on sending binary data as a SOAP attachment using the MTOM, XOP and/or Swaref. It seems comparatively straightforward to send image data this way (see this tutorial but I’m wondering about sending some nasty proprietary business stuff, like pps application/powerpoint or xls application/vnd.ms-excel. Do you have any suggestions?
As a tech writer, I am especially embarrassed by the unclosed parenthesis and missing noun in the previous comment…
See my latest post:
https://davidwburns.wordpress.com/2008/02/20/revisiting-the-whole-binary-serializationdeserialization-thing/
[…] Rubinoff Says: February 20, 2008 at 11:03 am e David, I’m a tech writer on NetBeans at Sun, covering web services. I want to create a […]