Enum Class DownloadTarget
- All Implemented Interfaces:
Serializable,Comparable<DownloadTarget>,Constable
Where the browser puts the content of a
Download.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionOpens the content in a new browser tab.Saves the content as a file, as the browser does for any download. -
Method Summary
Modifier and TypeMethodDescriptionstatic DownloadTargetReturns the enum constant of this class with the specified name.static DownloadTarget[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SAVE_AS_FILE
Saves the content as a file, as the browser does for any download. Content from a handler or another URL of the same origin is saved even if it is served inline, for example by a handler on whichinline()was called. For a URL of another origin, the server of that URL decides: content it serves inline may be shown instead of saved. -
NEW_TAB
Opens the content in a new browser tab. The browser shows the content when it can, for example a PDF, an image or plain text, and saves it as a file otherwise.A built-in handler, such as one from
DownloadHandler.forFile, is switched to serve its content inline, and this can not be undone. Do not reuse that handler instance where the content should be downloaded instead, for example in anAnchor: there the browser would show the content instead of saving it. Create a separate handler for each use instead. AnotherDownloadwithSAVE_AS_FILEcan share the handler, since it saves the content regardless.The new tab is opened without access to the opening page (
noopener) and without aRefererheader (noreferrer).
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-