views:

549

answers:

1

I want to create a WAR that would only contain a single zip file that is included in the of the web app, deploy that war to JBoss and be able to download the zipfile by accessing the root of the WAR.

So, currently I have a war, which has the zipfile in it, and this web.xml:

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"&gt;
<web-app>
    <display-name>Zipfile</display-name>
    <welcome-file-list>
        <welcome-file>file.zip</welcome-file>
    </welcome-file-list>
</web-app>

This war works, and I can download the file, but my browser can not know the name of the file. So where and how can I define the content-disposition header for that file to be "attachment; filename=file.zip"?

I know how to create a servlet that does this, but can I get by without the servlet?

A: 

Would the following do the trick? Create and index.jsp as welcome-file containing a scriplet that redirects the browser to file.zip.

Kees de Kooter
Thanks, that did it with very few lines. Created an index.jsp with only:<%response.sendRedirect("file.zip");%>