Enum Class FetchDirectiveKind

java.lang.Object
java.lang.Enum<FetchDirectiveKind>
org.htmlunit.csp.FetchDirectiveKind
All Implemented Interfaces:
Serializable, Comparable<FetchDirectiveKind>, Constable

public enum FetchDirectiveKind extends Enum<FetchDirectiveKind>
Enumerates the CSP fetch directive names and provides their fallback chains.

Each constant corresponds to a fetch directive defined in the CSP specification. The fallback list implements the directive fallback list algorithm, determining which directive governs a request when the most specific directive is not present.

For example, the fallback chain for ScriptSrcElem is: script-src-elem → script-src → default-src.

Author:
Salvation Team
  • Enum Constant Details

    • ChildSrc

      public static final FetchDirectiveKind ChildSrc
      The child-src fetch directive.
    • ConnectSrc

      public static final FetchDirectiveKind ConnectSrc
      The connect-src fetch directive.
    • DefaultSrc

      public static final FetchDirectiveKind DefaultSrc
      The default-src fetch directive (fallback for all other fetch directives).
    • FontSrc

      public static final FetchDirectiveKind FontSrc
      The font-src fetch directive.
    • FrameSrc

      public static final FetchDirectiveKind FrameSrc
      The frame-src fetch directive.
    • ImgSrc

      public static final FetchDirectiveKind ImgSrc
      The img-src fetch directive.
    • ManifestSrc

      public static final FetchDirectiveKind ManifestSrc
      The manifest-src fetch directive.
    • MediaSrc

      public static final FetchDirectiveKind MediaSrc
      The media-src fetch directive.
    • ObjectSrc

      public static final FetchDirectiveKind ObjectSrc
      The object-src fetch directive.
    • PrefetchSrc

      public static final FetchDirectiveKind PrefetchSrc
      The (deprecated) prefetch-src fetch directive.
    • ScriptSrcAttr

      public static final FetchDirectiveKind ScriptSrcAttr
      The script-src-attr fetch directive.
    • ScriptSrc

      public static final FetchDirectiveKind ScriptSrc
      The script-src fetch directive.
    • ScriptSrcElem

      public static final FetchDirectiveKind ScriptSrcElem
      The script-src-elem fetch directive.
    • StyleSrcAttr

      public static final FetchDirectiveKind StyleSrcAttr
      The style-src-attr fetch directive.
    • StyleSrc

      public static final FetchDirectiveKind StyleSrc
      The style-src fetch directive.
    • StyleSrcElem

      public static final FetchDirectiveKind StyleSrcElem
      The style-src-elem fetch directive.
    • WorkerSrc

      public static final FetchDirectiveKind WorkerSrc
      The worker-src fetch directive.
  • Method Details

    • values

      public static FetchDirectiveKind[] 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 FetchDirectiveKind 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
    • getRepr

      public String getRepr()
      Returns the lowercase directive name as it appears in a serialized CSP (e.g. "script-src-elem", "default-src").
      Returns:
      the directive name string
    • fromString

      public static FetchDirectiveKind fromString(String name)
      Looks up a FetchDirectiveKind by its lowercase directive name.
      Parameters:
      name - the directive name to look up (e.g. "script-src")
      Returns:
      the matching FetchDirectiveKind, or null if the name does not correspond to a known fetch directive