- All Implemented Interfaces:
Serializable,Comparable<WebRequest.FetchMode>,Constable
- Enclosing class:
- WebRequest
The mode of a request, as defined by the Fetch spec
(
https://fetch.spec.whatwg.org/#concept-request-mode).
This is used to compute the value of the Sec-Fetch-Mode request
header. Most WebRequest.FetchDestinations imply a fixed mode; this only needs
to be set explicitly to override that default - e.g. for a fetch()
call using an explicit mode option, or a subresource request using
the crossorigin attribute.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCORS-enabled requests, e.g.Navigations, e.g. top-level document loads,<iframe>/<frame>loads.Subresource requests without CORS, e.g.Same-origin requests, e.g. worker scripts, orfetch()withmode: 'same-origin'.WebSocket handshake requests. -
Method Summary
Modifier and TypeMethodDescriptiongetValue()Returns the value to be used for theSec-Fetch-Modeheader.static WebRequest.FetchModeReturns the enum constant of this class with the specified name.static WebRequest.FetchMode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SAME_ORIGIN
Same-origin requests, e.g. worker scripts, orfetch()withmode: 'same-origin'. -
NO_CORS
Subresource requests without CORS, e.g.<img>withoutcrossorigin. -
CORS
CORS-enabled requests, e.g.XMLHttpRequest,fetch()default, or module scripts. -
NAVIGATE
Navigations, e.g. top-level document loads,<iframe>/<frame>loads. -
WEBSOCKET
WebSocket handshake requests.
-
-
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
-
getValue
Returns the value to be used for theSec-Fetch-Modeheader.- Returns:
- the value to be used for the
Sec-Fetch-Modeheader
-