I have been trying to find out a way to set content type for static resources within my web application, which are provided as downloadable links. For example I have a .CSV file and when I provide this link on the browser, upon click it's opening in a new window. What I really want is to either 1) download automatically or 2) browser to throw 'Open or Save as' dialog. I'm using Icefaces to render the link but this doesn't matter, I can use plain html with javascript or jquery. Here is my code.
<ice:outputLink id="location" value="#{bean.downloadLink}" type="application/x-download" target="_blank">
<ice:outputText value="Download"/>
</ice:outputLink>
Please note that I'm not streaming the file content through http response. If I did that I could have easily set content type and content disposition tags to achieve what I wanted. What I really want is a way to set these headers while rendering static resources as direct links.