Open streamResource in 7.0.0.beta1

Hello,

Use the following commands to open a report in 7.0.0.alpha3

        ....
       StreamResource resource = new StreamResource(source, "xxxx.pdf#zoom=100", getApplication());
        resource.setMIMEType("application/pdf");

        Page.getCurrent().open(resource, "_new");

How how can I do this in 7.0.0.beta1?

Thanks.

I’m afraid this is an area where we have prematurely removed an old slightly awkward and in some cases completely broken feature before any real replacement has been developed.

Rest assured that we are actively working on replacing Page.open(Resource) and similar methods with a mechanisms that should be more future-proof and that we will not release a final version of Vaadin 7.0.0 before the functionality is in place.

In the meantime, you can resort to using the Link(String, Resource) constructor for creating a link that the user can click to start the download. I am aware that this is not always acceptable for usability reasons, but it’s unfortunately the only reasonable way of starting a download until
#9524
has been implemented.

Thank you,

I am having similar problem in Vaadin 7.0. I tried to open a StreamResource for user to download a file when the user clicks a button (instead of a link). Page doesn’t seem to have the open API for Resource.

How can I achieve something like this: UI.getCurrent().getPage().open(new StreamResource (ss, "Filename.zip), “_blank”); ?

Thanks!