- All Implemented Interfaces:
Serializable,Comparable<ReferrerPolicy>,Constable
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
The referrer policies; a referrer policy determines the referrer (the Referer header) of a request.
The referrer policies; a referrer policy determines the referrer (the Referer header) of a request.
- Author:
- Ronald Brill
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionNo referrer at all.The full url, but no referrer from https to http.Only the origin.The full url for same-origin requests, only the origin for cross-origin requests.The full url for same-origin requests, no referrer for cross-origin requests.Only the origin, but no referrer from https to http.The full url for same-origin requests, only the origin for cross-origin requests, no referrer from https to http; this is the default.Always the full url. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ReferrerPolicyfromHeader(String headerValue) Returns the policy of the value of the Referrer-Policy header: the last known token of the comma separated list.static ReferrerPolicyfromMetaContent(String content) Returns the policy for the content of a meta element with the name 'referrer'; the legacy values ('never', 'default', 'always' and 'origin-when-crossorigin') are supported.static ReferrerPolicyReturns the policy for the given token (case-insensitive); used for the referrerpolicy attribute.getReferrer(URL referrerUrl, URL targetUrl, BrowserVersion browserVersion) Determines the referrer for a request to the target url.getToken()Returns the token of this policy (e.g.static ReferrerPolicyReturns the enum constant of this class with the specified name.static ReferrerPolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NO_REFERRER
No referrer at all. -
NO_REFERRER_WHEN_DOWNGRADE
The full url, but no referrer from https to http. -
SAME_ORIGIN
The full url for same-origin requests, no referrer for cross-origin requests. -
ORIGIN
Only the origin. -
STRICT_ORIGIN
Only the origin, but no referrer from https to http. -
ORIGIN_WHEN_CROSS_ORIGIN
The full url for same-origin requests, only the origin for cross-origin requests. -
STRICT_ORIGIN_WHEN_CROSS_ORIGIN
The full url for same-origin requests, only the origin for cross-origin requests, no referrer from https to http; this is the default. -
UNSAFE_URL
Always the full url.
-
-
Field Details
-
DEFAULT
The default policy.
-
-
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
-
getToken
Returns the token of this policy (e.g. 'no-referrer').- Returns:
- the token
-
fromToken
Returns the policy for the given token (case-insensitive); used for the referrerpolicy attribute.- Parameters:
token- the token- Returns:
- the policy or
nullif the token is not a known policy
-
fromMetaContent
Returns the policy for the content of a meta element with the name 'referrer'; the legacy values ('never', 'default', 'always' and 'origin-when-crossorigin') are supported.- Parameters:
content- the content- Returns:
- the policy or
nullif the content is not a known policy - See Also:
-
fromHeader
Returns the policy of the value of the Referrer-Policy header: the last known token of the comma separated list.- Parameters:
headerValue- the header value- Returns:
- the policy or
nullif the value contains no known token - See Also:
-
getReferrer
Determines the referrer for a request to the target url.- Parameters:
referrerUrl- the url of the referrer (without user info and ref)targetUrl- the url of the requestbrowserVersion- the browser version- Returns:
- the referrer (the value of the Referer header) or
nullif there is no referrer - See Also:
-