Open StreamResource without Browser-CloseEvent


following problem:

When the client closes his browser a CloseEvent will be fired. I’m catching this and close the application also on server-side:


Now I generate an PDF and want so send it to the client:

StreamResource sr = new StreamResource(streamSource, "MyDoc.pdf",

By doing this the browser on client-side will be fired a CloseEvent and the Client can’t receive the pdf-file.
How can I send the pdf to the client without closing the application?

The following solution will be blocked by the browser:

event.getButton().getWindow().open(sr, “_blank”);

Any other suggestions?

How about providing a DownloadStream using URIHandler? It doesn’t behave exactly the same, but I think it could work. Anyway, why are you closing application in the window close?