I am trying to put some .msi and .cab files on my JBoss portal. However, when I click on the link on the page, the page attempts to render the files instead of executing them. I figure there is some configuration that I am missing in JBoss.
Can anyone tell me which file to add this config info to and what to add?
Thanks a bunch!
What you mean by "the page attempts to render the file"? To me that means that the server processes the files and attempts to generate HTML based on their contents. If you really mean that, then there must be some mapping in you web.xml file that maps files with those extensions to some servlet.
If, instead, you mean that when clicking on the link the browser attempts to "run" them, and doesn't give the option of saving them, then go to the server/xxx/deploy/jboss-web.deployer/conf/web.xml file. At the end of that file there is a long list of mime mappings. You could add mappings there for msi and cab - using the same mime-type as zip would probably work, or you could google for a more accurate mime type.
Finally, often the choice of running a file rather than allowing you to save it is based on file extension and mime mapping kept within the browser. Check those mappings in your browser.
Thank you for the information, Peter!
Yes. The server attempts to generate HTML based on the contents of the msi/cab files. Adding the mime mappings to the
server/xxx/deploy/jboss-web.deployer/conf/web.xml file did resolve this issue. This addition is a bit too general, though -- we would have to regression test all applications running on Jboss. The web.xml file suggests that there is a way to configure mime mappings on a per application basis. However, adding the same mime mappings to the web.xml file located in the application WAR does nothing. Do they mime mappings have to reside exclusively in the server/xxx/deploy/jboss-web.deployer/conf/ directory to take effect?
You should be able to place them in your local web.xml because the global one is merged with the local one to create the settings used for your web app. My guess is that one of the mappings (servlet, perhaps?) in your web.xml is causing those files to be passed to your code for processing. I added a couple of links to and MSI and CAB file in one of my apps and when I clicked on the link I got the file download box, as expected.
Wait a second, What browser are you using? I used Firefox. Then I tried IE and it displayed the binary contents of each file. You'd think that the M$ guys would be smart enough to tell IE what to do with MSI and CAB files. Sigh.
Here is an example. Let's say that you have this file within your xxx.war (I'll include the war file in this path to provide context):
Then use this anchor tag:
To directly access the file use this URL in the browser:
In other works, there is no difference between how an html, css, gif, msi, exe or static file is access within a web app.