2 Replies Latest reply on Jan 28, 2010 6:19 AM by nbelaevski

    a4j:mediaOutput as a download link - issues with URL length

      I am using a4j:mediaOutput to render a download link like this:

      <a4j:mediaOutput element="a" cacheable="false" createContent="#{exportView.createContent}"
      value="#{row.export.id}" mimeType="application/zip">
       <h:graphicImage url="../img/download16.png" title="download"/>
      </a4j:mediaOutput>
      


      The data behind the link is a ZIP file stored in a database as a blob. In principle it works, but there is an ugly thing:

      When the user clicks at the link, then, in the browser's save as dialogue, the suggested file name is several hundred characters long and has the extension .jsf. When the user clicks on save, the browser says that the file name is invalid. So, the user has to rename the file and he/she must not forget to give it the correct .zip extension, otherwise he/she will not be able to open the saved file.

      I have tested this under windows with FF 3 and IE 7.

      I would like the application to generate a meaningful file name that will be suggested to the user in the browser's save as dialogue, and the extension should be .zip. Is there a way to do this with a5j:mediaOutput or do I have to write my own servlet to deliver the zip files?