How to detect when Vaadin FileDownloader succeeds or fails

倾然丶 夕夏残阳落幕 提交于 2019-11-30 22:51:08

After more research I believe the answer is that there is no simple way to get this information from the FileDownloader.

The difficulty appears to be a consequence of the way the FileDownloader is designed. From the FileDownloader docs: "Download should be started directly when the user clicks e.g. a Button without going through a server-side click listener to avoid triggering security warnings in some browsers."

Because there is no round-trip back to the web server, there is no place to respond when the download fails, starts, or succeeds.

Some vague (and possibly bad) ideas for a workaround:

  • Have JS post some kind of asynchronous notification to the web server, letting it know what happened. (Using JMS or Ajax?)
  • If there was some kind active process on the backend involved with transferring the file, it would know when the transfer happened.

But the short answer seems to be there is no built-in way in Vaadin to do it.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!