Package com.vaadin.flow.server.streams
Class AbstractDownloadHandler<R extends AbstractDownloadHandler>
java.lang.Object
com.vaadin.flow.server.streams.TransferProgressAwareHandler<DownloadEvent,R>
com.vaadin.flow.server.streams.AbstractDownloadHandler<R>
- Type Parameters:
R
- the type of the subclass implementing this abstract class
- All Implemented Interfaces:
DownloadHandler
,ElementRequestHandler
,Serializable
- Direct Known Subclasses:
ClassDownloadHandler
,FileDownloadHandler
,InputStreamDownloadHandler
,ServletResourceDownloadHandler
public abstract class AbstractDownloadHandler<R extends AbstractDownloadHandler>
extends TransferProgressAwareHandler<DownloadEvent,R>
implements DownloadHandler
Abstract class for common methods used in pre-made download handlers.
- Since:
- 24.8
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
getContentType
(String fileName, VaadinResponse response) protected TransferContext
getTransferContext
(DownloadEvent transferEvent) This method is used to get the transfer context from the transfer events (e.g.inline()
Sets this download content to be displayed inside the Web page, or as the Web page, e.g.boolean
isInline()
Returns if the download content to be displayed inside the Web page or downloaded as a file.Methods inherited from class com.vaadin.flow.server.streams.TransferProgressAwareHandler
addTransferProgressListener, getListeners, notifyError, onProgress, onProgress, onProgress, onProgress, whenComplete, whenComplete, whenStart, whenStart
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.server.streams.DownloadHandler
handleDownloadRequest, handleRequest
Methods inherited from interface com.vaadin.flow.server.streams.ElementRequestHandler
getDisabledUpdateMode, getUrlPostfix, isAllowInert
-
Constructor Details
-
AbstractDownloadHandler
public AbstractDownloadHandler()
-
-
Method Details
-
getTransferContext
Description copied from class:TransferProgressAwareHandler
This method is used to get the transfer context from the transfer events (e.g.DownloadEvent
).- Specified by:
getTransferContext
in classTransferProgressAwareHandler<DownloadEvent,
R extends AbstractDownloadHandler> - Parameters:
transferEvent
- the transfer event- Returns:
- the transfer context
-
getContentType
-
inline
Sets this download content to be displayed inside the Web page, or as the Web page, e.g. as an image or inside an iframe.Implementations of this class should ensure that the 'Content-Disposition' attribute is 'inline', if this method is called.
- Returns:
- this instance for method chaining
-
isInline
public boolean isInline()Returns if the download content to be displayed inside the Web page or downloaded as a file.- Returns:
- true if the content is to be displayed inline, false if it is to be downloaded as a file
-