Enum Class DownloadDisposition

java.lang.Object
java.lang.Enum<DownloadDisposition>
com.vaadin.flow.server.streams.DownloadDisposition
All Implemented Interfaces:
Serializable, Comparable<DownloadDisposition>, Constable

public enum DownloadDisposition extends Enum<DownloadDisposition>
Whether the browser should show downloaded content or save it as a file, as sent in the Content-Disposition header.

Whether content is shown or saved depends on where it is used, not on what it is: the same PDF can be shown in a new browser tab and saved from a download link. The place that registers a DownloadHandler, such as a component that shows an image, sets the disposition on the registered resource. A handler that gives only a file name, with DownloadEvent.fileName(String) as the built-in handlers do, is then served with that type. A handler that asks for a type itself, with DownloadEvent.attachment(String) or DownloadEvent.inline(String), keeps its choice.

Since:
25.4
See Also:
  • Enum Constant Details

    • INLINE

      public static final DownloadDisposition INLINE
      The browser shows the content, for example as an image, in an iframe or in a new tab.
    • ATTACHMENT

      public static final DownloadDisposition ATTACHMENT
      The browser saves the content as a file.
  • Method Details

    • values

      public static DownloadDisposition[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DownloadDisposition valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null