RE: Vaadin 7+, why is Page.open() deprecated?

I think the reason for deprecation is that the browser will show the user a non-friendly “popup page was prevented” notification. Instead you should use
BrowserWindowOpener
or
FileDownloader
when possible.

Sometimes it can of course be pretty much impossible to use those approaches if your UI logic is somehow driven by a backend logic that you cannot predict. e.g. scenario where you you advance from one step in a process to the next and in the next step you need to have 5 files downloaded to the user’s local machine.

In this case you could provide a Vaadin UI with 5 links to these files and the user then needs to individually click all these file links or just live with the fact that the user needs to allow pop-up windows from your application.

And it suggest to use a link, which is completely useless if you want to open download without a link…

yeah but why not allow both options instead of deprecating one that is useful as well?

But there is no alternative for downloading resources that do not require user interaction… ie create in separate thread and polling server will open and download the resource

Both FileDownload and BrowserWindowOpener require component as base of interaction…

Now that I took a look at the API docs, it looks like only the Resource accepting versions of the open method are deprecated:

open(Resource resource, String windowName, boolean tryToOpenAsPopup) open(Resource resource, String windowName, int width, int height, BorderStyle border) But the String based variants are not marked as deprecated:

open(String url, String windowName) open(String url, String windowName, boolean tryToOpenAsPopup) open(String url, String windowName, int width, int height, BorderStyle border) The reason for deprecation is also documented in the API docs:
“This is because the usage of Resource is problematic with memory management and with security features in some browsers.”

OK, I see!
I would approach the problem like this:

  1. user initiates a file creation
  2. show the user a loading indicator and start the file genaration into a backround thread
  3. when file generation is done,
    push
    a message “File generation done!” and a “Download” button to the Vaadin UI where the download button is extended with a FileDownloader.

Alternatively to the 3rd step you could have separate servlet serving these generated files and use one of the String version of Page.open() to link to that servlet with appropriate request parameters.