@@ -0,0 +1,2422 @@
+package com.vaadin.tests.resources;%0D%0A%0D%0Aimport java.io.FileInputStream;%0D%0Aimport java.io.FileNotFoundException;%0D%0Aimport java.io.InputStream;%0D%0A%0D%0Aimport com.vaadin.terminal.StreamResource;%0D%0Aimport com.vaadin.terminal.StreamResource.StreamSource;%0D%0Aimport com.vaadin.tests.components.TestBase;%0D%0Aimport com.vaadin.ui.Button;%0D%0Aimport com.vaadin.ui.Button.ClickEvent;%0D%0Aimport com.vaadin.ui.Button.ClickListener;%0D%0A%0D%0Apublic class ResourceDownload extends TestBase %7B%0D%0A%0D%0A    @Override%0D%0A    public void setup() %7B%0D%0A%0D%0A        Button b = new Button(%22Download (_new)%22, new ClickListener() %7B%0D%0A            public void buttonClick(ClickEvent event) %7B%0D%0A                download(%22_new%22);%0D%0A            %7D%0D%0A        %7D);%0D%0A        addComponent(b);%0D%0A%0D%0A        b = new Button(%22Download (_blank)%22, new ClickListener() %7B%0D%0A            public void buttonClick(ClickEvent event) %7B%0D%0A                download(%22_blank%22);%0D%0A            %7D%0D%0A        %7D);%0D%0A        addComponent(b);%0D%0A%0D%0A        b = new Button(%22Download ()%22, new ClickListener() %7B%0D%0A            public void buttonClick(ClickEvent event) %7B%0D%0A                download(%22%22);%0D%0A            %7D%0D%0A        %7D);%0D%0A        addComponent(b);%0D%0A%0D%0A        b = new Button(%22Download (_top)%22, new ClickListener() %7B%0D%0A            public void buttonClick(ClickEvent event) %7B%0D%0A                download(%22_top%22);%0D%0A            %7D%0D%0A        %7D);%0D%0A        addComponent(b);%0D%0A%0D%0A    %7D%0D%0A%0D%0A    protected void download(String target) %7B%0D%0A        String filename = %22filename%22;%0D%0A        StreamResource streamResource = new StreamResource(new StreamSource() %7B%0D%0A%0D%0A            public InputStream getStream() %7B%0D%0A                try %7B%0D%0A                    return new FileInputStream(%22FIXME C:/temp/file.xls%22);%0D%0A                %7D catch (FileNotFoundException e) %7B%0D%0A                    // TODO Auto-generated catch block%0D%0A                    e.printStackTrace();%0D%0A                    return null;%0D%0A                %7D%0D%0A            %7D%0D%0A        %7D, filename + %22.xls%22, this);%0D%0A        streamResource.setCacheTime(5000); // no cache (%3C=0) does not work with%0D%0A        // IE8%0D%0A        streamResource.setMIMEType(%22application/x-msexcel%22);%0D%0A%0D%0A        this.getMainWindow().open(streamResource, target);%0D%0A%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    protected String getDescription() %7B%0D%0A        return %22Downloading with target _new should work, aswell as with target _blank and _top.%22;%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    protected Integer getTicketNumber() %7B%0D%0A        return 3289;%0D%0A    %7D%0D%0A%7D%0D%0A

Test case for #3289