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 Details

    • AbstractDownloadHandler

      public AbstractDownloadHandler()
  • Method Details

    • getTransferContext

      protected TransferContext getTransferContext(DownloadEvent transferEvent)
      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 class TransferProgressAwareHandler<DownloadEvent,R extends AbstractDownloadHandler>
      Parameters:
      transferEvent - the transfer event
      Returns:
      the transfer context
    • getContentType

      protected String getContentType(String fileName, VaadinResponse response)
    • inline

      public R 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