downloading 2 files in a row

I’m having trouble trying to download 2 files in response to a Button click, but it appears that my second call to getMainWindow().open() always overrides the first.

 
           public void buttonClick(ClickEvent event)
            {
                clear();
                try
                {
                    {
                        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                        df.setTimeZone(TimeZone.getTimeZone("GMT"));
                        String filename = System.getProperty("catalina.base") + "/logs/catalina." + df.format(new Date()) + ".log";
                        File file = new File(filename);
                        if (!file.exists())
                            output("couldn't find " + filename);
                        else
                        {
                            FileResource fr = new FileResource(file, getWindow().getApplication());
                            getWindow().getApplication().getMainWindow().open(fr);
                            output("downloading " + filename);
                        }
                    }
                    {
                        String filename = System.getProperty("catalina.base") + "/logs/catalina.out";
                        File file = new File(filename);
                        if (!file.exists())
                            output("couldn't find " + filename);
                        else
                        {
                            FileResource fr = new FileResource(file, getWindow().getApplication());
                            getWindow().getApplication().getMainWindow().open(fr);
                            output("downloading " + filename);
                        }
                    }
                }
                catch (Exception ex)
                {
                    output("failed! " + ex);
                }
            }

This results in 2 “downloading …” messages in the output, but only the second file actually begins downloading. I’ve reversed the order of the downloads, and it’s always the second one. Do I need to somehow wait for the first download to finish before starting the second? If so, I can’t find any way to do that.

Not sure, but usually you can only have one download per window.
So you could try to open a second window and send the other download to that window.

When we need to send multiple files to the client browser we have always created a zip file and then sent that one to the browser…
Not the very best solution, but http does not allow other things…

André