Is there no way to open StreamResource as attachment?

Looking at the vaadin flow (14) source: when working with StreamResource, StreamResourceHandler simply has no way to get the information about the attachment so therefore all downloads are forced to show on page. Why isn’t there a way to specify other stream headers? Such as other cache options (except time) or attachment or anything else?

As a workaround, you can use the download attribute on links that should trigger downloads. This will prevent the browser from opening the target URL as a page regardless of response headers.

But that leads to double button setups which are really awkward… like I have a button that generates data but then I have to have another button that downloads it? I know it’s because popup blocking (if I use open() like I should) but Vaadin is used in intranet applications as well where popup blocking is disabled on application urls… Looks like the only way now is to make my own servlet where I can actually specify what I need but that’s like half reinventing the wheel.

Also, why is open with target private?

I see. In that case the workaround isn’t really applicable.

The open method with a target was recently made public through and will be included in Vaadin 14.2.