Notification problem in fileDownload exceptions

Hi,

We are upgrading our Vaadin 6 project to 7. FileDownloder not supporting deferred downloads so We found a solution like Johannes’s,


https://vaadin.com/old-forum/-/message_boards/view_message/3658567

Our project has a exception handling mechanism that provided by vaadin. If an exception throws in getStream() our errorHandler not catching exception because VaadinServlet gets errorhandler from session.

I set errorhandler to session. This time exceptions are handling by ErrorHandler but it doesn’t display any notification.
I attached a sample project.

Any suggestions?

Thanks,
Beslan
13103.zip (19.3 KB)

The problem is that due to how browsers and HTTP work, when handling a download request, there’s no way of communicating any UI changes to the client side in the same response. So a notification etc. isn’t shown until the next UI update request.

In Vaadin 7.1 you can enable polling or push to ensure the client receives the changes as soon as possible - the Upload component actually does its own polling even in Vaadin 6 to do just this. In 7.0, you can use an add-on such as Refresher. Or you can kill two birds with one stone and display a ProgressIndicator that gives you the polling for free, in addition to indicating to the user that something’s happening. Note that you must do this in a separate ClickListener, added to the same button you add the FileDownloader to.

Note also that the getStream method is invoked while holding the session lock, so any concurrent UI changes will be blocked during its execution - this is relevant if it, for instance, takes a while to generate the download. Please see
this forum thread
and
ticket #12264
.

It does seem that errors in download requests should be handled by the most specific error handler found in the tree, just like with UI requests - opened
ticket #12269
for this.

Thanks Johannes. We’ll upgrade Vaadin version to 7.1.