I am trying to download a zip file using Vaadin without the user having to click a button. This can be done using Page.open()
. My problem is that I am setting the StreamResource to download this way:
final StreamResource myResource = createResource();
setResource("dl", myResource);
getUI().getConnectorTracker().setDiffState(this, null);
final ResourceReference ref = ResourceReference.create(myResource, UI.getCurrent(), "dl");
Unfortunately ref.getURL()
is null, which does not allow me to open the file. This thread is the approach I was trying to implement.