public class UIFileResource extends com.vaadin.server.StreamResource implements ResourceDownloadHandler
core::File.
If there is an instance of UIComponent provided, there is a new
Events.FILE_DOWNLOAD_EVENT_TYPE event created when the resource is
used.| Constructor and Description |
|---|
UIFileResource(Variant.ClosureVariant closure,
UIComponent uiComponent,
boolean fireDownloadEvent,
boolean forceSave)
Full constructor.
|
| Modifier and Type | Method and Description |
|---|---|
com.vaadin.server.DownloadStream |
getStream() |
boolean |
handleResourceDownload(com.vaadin.server.VaadinRequest req,
com.vaadin.server.VaadinResponse resp)
Writes the resource content to the response object.
|
equals, getBufferSize, getCacheTime, getFilename, getMIMEType, getStreamSource, hashCode, setBufferSize, setCacheTime, setFilename, setMIMEType, setStreamSourcepublic UIFileResource(Variant.ClosureVariant closure, UIComponent uiComponent, boolean fireDownloadEvent, boolean forceSave)
closure - a closure which returns the File RecordHolder. Not null.uiComponent - not null. Closure is run in the context of this component. Also, UI download event is fired in context of this component.fireDownloadEvent - true if the download should trigger a download eventforceSave - true if the browser should ask the user to save the filepublic com.vaadin.server.DownloadStream getStream()
getStream in interface com.vaadin.server.ConnectorResourcegetStream in class com.vaadin.server.StreamResourcepublic boolean handleResourceDownload(com.vaadin.server.VaadinRequest req,
com.vaadin.server.VaadinResponse resp)
throws IOException
ResourceDownloadHandlerUIComponent#handleConnectorRequest(VaadinRequest, VaadinResponse, String)
when UIFileResource is used so that the request returns 404 error instead
of server error.
DO *not* call with Vaadin session lock - blocks until the file is downloaded by the client.handleResourceDownload in interface ResourceDownloadHandlerIOExceptionCopyright © 2007-2018 Whitestein Technologies. All Rights Reserved.