Extension that starts a download when the extended component is clicked. This is used to overcome two challenges:
- Resource should be bound to a component to allow it to be garbage collected when there are no longer any ways of reaching the resource.
- Download should be started directly when the user clicks e.g. a Button without going through a server-side click listener to avoid triggering security warnings in some browsers.
Please note that the download will be started in an iframe, which means that care should be taken to avoid serving content types that might make the browser attempt to show the content using a plugin instead of downloading it. Connector resources (e.g. {@link FileResource} and {@link ClassResource}) will automatically be served using a Content-Type: application/octet-stream
header unless {@link #setOverrideContentType(boolean)} has been set to false
while files served in other ways, (e.g. {@link ExternalResource} or{@link ThemeResource}) will not automatically get this treatment.
@author Vaadin Ltd
@since 7.0.0