How to download a file from specified location using vaadin?

Hi all,

I need to download a .txt file (or) .html file from specified location.

can any one help, how to download using vaadin.

Thanks in advance for your kind reply.

regards,
Aravind

You need to provide the downloadable file as a
resource
, usually bound to the
Link component
. There’s different types of resources, so pick the one suitable for your case, depending on where the files are stored.

To force the browser to open “Save As” dialog, rather than displaying the file in the browser (if it’s HTML for example), you should set the Content-Disposition, as done in
this example
. Some discussion about it
here
.

There’s also the FileDownloader add-on, see
this article
.