Package jenkins.security.csp
Enum Class FetchDirective
- All Implemented Interfaces:
Serializable,Comparable<FetchDirective>,Constable
@Restricted(org.kohsuke.accmod.restrictions.Beta.class)
public enum FetchDirective
extends Enum<FetchDirective>
The fetch directives and their inheritance rules (in
getFallback()).- Since:
- TODO
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic FetchDirectiveReturns theFetchDirectivecorresponding to the specified key.Which element is used as fallback if one is undefined.static booleanisFetchDirective(String key) Returns true if and only if the specified key is aFetchDirective.static Optional<FetchDirective> toFetchDirective(String key) toKey()static FetchDirectiveReturns the enum constant of this class with the specified name.static FetchDirective[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DEFAULT_SRC
-
CHILD_SRC
-
CONNECT_SRC
-
FONT_SRC
-
FRAME_SRC
-
IMG_SRC
-
MANIFEST_SRC
-
MEDIA_SRC
-
OBJECT_SRC
-
PREFETCH_SRC
-
SCRIPT_SRC
-
SCRIPT_SRC_ELEM
-
SCRIPT_SRC_ATTR
-
STYLE_SRC
-
STYLE_SRC_ELEM
-
STYLE_SRC_ATTR
-
WORKER_SRC
-
-
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
-
toKey
-
fromKey
Returns theFetchDirectivecorresponding to the specified key. For example, the parameterdefault-srcwill returnDEFAULT_SRC.- Parameters:
s- the key for the directive- Returns:
- the
FetchDirectivecorresponding to the key
-
isFetchDirective
Returns true if and only if the specified key is aFetchDirective. Returnstrueforscript-src,falseforsandbox. -
toFetchDirective
Similar tofromKey(String), this returns the correspondingFetchDirectivewrapped inOptional. If the specified key does not correspond to a fetch directive, instead leaves the Optional empty.- Parameters:
key- the key for the directive- Returns:
- an
Optionalcontaining the correspondingFetchDirective, or left empty if there is none.
-
getFallback
Which element is used as fallback if one is undefined. For*-src-elemand*-src-attrthis is the corresponding*-src, forframe-srcandworker-srcthis ischild-src, for everything else, exceptdefault-src, it'sdefault-src.- Returns:
- The fallback directive if this one is unspecified, or
nullif there is no fallback. - See Also:
-