Vaadin 7.3 beta Download

Hi, i’m testing vaadin 7.3 beta

I have some trouble to have FileDownloadre running, when i execute the code that i posted, nothing happen.

Any advice ?
Thanks

    public void startDownload(String externalUrl) {
        try {
            
            
            DownloadResourceExternal downloadResourceExt = new DownloadResourceExternal(new URL(externalUrl));
            DownloadResource downloadResource = new DownloadResource(downloadResourceExt.getInputStream(), downloadResourceExt.getFilename());
            downloadResource.getStream().setParameter("Content-Length", String.valueOf(downloadResourceExt.getSize()));
            downloadResource.getStream().setCacheTime(0);
                        
            Button b = new Button("download");
            FileDownloader fd = new FileDownloader(downloadResource);
            fd.extend(b);
            b.click();
  
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }

Hi, nobody can help ?
thanks

Did your code work before 7.3?
Also what is DownloadResource?

Hi,

Thanks for the reply,

i’m doing a porting from 6.8 to 7.3 , i do not know if it run on 7.2.6 but i can test it.

The DownloadResource is my class uset do manager the file resource to download i use it to get the stream.

Thanks.

Okay I should’ve looked at your code more carefully. You’re using button.click() which only does everything click related on the Server side. FileDownloader needs a click from the client side though. So a real user actually clicking the button. Otherwise the Browser might block the download.
More on this topic and some “solutions”:
https://vaadin.com/forum#!/thread/3991491

Ok, thanks,

i will check the post you linked.

Regards