Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Download (Stream/File Resource) via window.open() opening new App

Alan Roche
1 decade ago Jul 14, 2011 11:38am


At a bit of a stone wall with this one, I'm wondering if anyone can give me some pointers.

Basically whats happening is instead of the browser opening a file dialog to download the file, another browser window opens with the Vaadin App main window (and its widgets) contained within it I suspect it might be related to the fact I'm running Vaadin embedded in an HTML div within an HTML page (as its an existing web application).

I'm running a Vaadin Applicaiton embedded in div within an HTML file (that happens to be served up via Spring MVC, though this should be irrelevant).
The vaadin app is bound to a particular path under the context root.

My Web.xml looks like this:

            <description>Partner Application</description>


It all works great until I try to serve up a dynamically generated Open Office file.

Here's a trivial example of downloading a smple text file, which exhibits the problem

addListener(new ClickListener() {
                public void buttonClick(ClickEvent event) {
                    final FileResource stream = new FileResource(new File(""),
                            PartnerApplication.getInstance()) {
                        public DownloadStream getStream() {
                            ByteArrayInputStream in = new ByteArrayInputStream(
                                    "Simple Text File".getBytes());
                            DownloadStream ds = new DownloadStream(in,
                                    "text/plain", "test.txt");
                            // Need a file download POPUP
                                    "attachment; filename=test.txt");
                            return ds;


The URL of the window (that opens instead of the file download dialog that I expect) is :
(where client-reader-web is the context root).

I'm running Vaadin version 6.6.0 if that's important.

Thanks for any help!!

Alan Roche
1 decade ago Jul 20, 2011 8:37am
Jarno Rantala
1 decade ago Jul 20, 2011 9:12am
Alan Roche
1 decade ago Jul 20, 2011 10:56am
Alan Roche
1 decade ago Jul 20, 2011 11:22am
Tomas Vala
1 decade ago Jul 20, 2011 11:33am
Henri Sara
1 decade ago Jul 20, 2011 12:07pm
Alan Roche
1 decade ago Jul 21, 2011 10:41am
Alan Roche
1 decade ago Jul 21, 2011 11:00am
ade amrillah
1 decade ago Feb 28, 2012 5:10pm
Tudor Raneti
1 decade ago Jul 08, 2012 3:41pm