Package com.helger.html.hc.html.links
Enum EHCReferrerPolicy
- java.lang.Object
-
- java.lang.Enum<EHCReferrerPolicy>
-
- com.helger.html.hc.html.links.EHCReferrerPolicy
-
- All Implemented Interfaces:
IHCHasHTMLAttributeValue,com.helger.xml.microdom.IHasAttributeValue,Serializable,Comparable<EHCReferrerPolicy>
public enum EHCReferrerPolicy extends Enum<EHCReferrerPolicy> implements IHCHasHTMLAttributeValue
Referrer policy
Source: https://w3c.github.io/webappsec-referrer-policy/#referrer-policy- Since:
- 8.4.0.
- Author:
- Philip Helger
-
-
Enum Constant Summary
Enum Constants Enum Constant Description NO_REFERRERThe simplest policy is "no-referrer", which specifies that no referrer information is to be sent along with requests to any origin.NO_REFERRER_WHEN_DOWNGRADEThe "no-referrer-when-downgrade" policy sends a request’s full referrerURL stripped for use as a referrer for requests: whose referrerURL and current URL are both potentially trustworthy URLs, or whose referrerURL is a non-potentially trustworthy URL. Requests whose referrerURL is a potentially trustworthy URL and whose current URL is a non-potentially trustworthy URL on the other hand, will contain no referrer information.NONEThe empty string "" corresponds to no referrer policy, causing a fallback to a referrer policy defined elsewhere, or in the case where no such higher-level policy is available, falling back to the default referrer policy.ORIGINThe "origin" policy specifies that only the ASCII serialization of the request’s referrerURL is sent as referrer information when making both same-origin-referrer requests and cross-origin-referrer requests.ORIGIN_WHEN_CROSS_ORIGINThe "origin-when-cross-origin" policy specifies that a request’s full referrerURL is sent as referrer information when making same-origin-referrer requests, and only the ASCII serialization of the origin of the request’s referrerURL is sent as referrer information when making cross-origin-referrer requests.SAME_ORIGINThe "same-origin" policy specifies that a request’s full referrerURL is sent as referrer information when making same-origin-referrer requests.STRICT_ORIGINThe "strict-origin" policy sends the ASCII serialization of the origin of the referrerURL for requests: whose referrerURL and current URL are both potentially trustworthy URLs, or whose referrerURL is a non-potentially trustworthy URL. Requests whose referrerURL is a potentially trustworthy URL and whose current URL is a non-potentially trustworthy URL on the other hand, will contain no referrer information.STRICT_ORIGIN_WHEN_CROSS_ORIGINThe "strict-origin-when-cross-origin" policy specifies that a request’s full referrerURL is sent as referrer information when making same-origin-referrer requests, and only the ASCII serialization of the origin of the request’s referrerURL when making cross-origin-referrer requests: whose referrerURL and current URL are both potentially trustworthy URLs, or whose referrerURL is a non-potentially trustworthy URL. Requests whose referrerURL is a potentially trustworthy URL and whose current URL is a non-potentially trustworthy URL on the other hand, will contain no referrer information.UNSAFE_URLThe "unsafe-url" policy specifies that a request’s full referrerURL is sent along for both same-origin-referrer requests and cross-origin-referrer requests.
-
Field Summary
Fields Modifier and Type Field Description static EHCReferrerPolicyDEFAULTDefault policy: strict-origin-when-cross-origin
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAttrValue()static EHCReferrerPolicygetFromAttrValueOrNull(String sAttrValue)static EHCReferrerPolicyvalueOf(String name)Returns the enum constant of this type with the specified name.static EHCReferrerPolicy[]values()Returns an array containing the constants of this enum type, in the order they are declared.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Methods inherited from interface com.helger.html.hc.html.IHCHasHTMLAttributeValue
hasAttrValue
-
-
-
-
Enum Constant Detail
-
NONE
public static final EHCReferrerPolicy NONE
The empty string "" corresponds to no referrer policy, causing a fallback to a referrer policy defined elsewhere, or in the case where no such higher-level policy is available, falling back to the default referrer policy. This happens in Fetch’s main fetch algorithm, for example.
-
NO_REFERRER
public static final EHCReferrerPolicy NO_REFERRER
The simplest policy is "no-referrer", which specifies that no referrer information is to be sent along with requests to any origin. The header Referer will be omitted entirely.
-
NO_REFERRER_WHEN_DOWNGRADE
public static final EHCReferrerPolicy NO_REFERRER_WHEN_DOWNGRADE
The "no-referrer-when-downgrade" policy sends a request’s full referrerURL stripped for use as a referrer for requests:- whose referrerURL and current URL are both potentially trustworthy URLs, or
- whose referrerURL is a non-potentially trustworthy URL.
-
SAME_ORIGIN
public static final EHCReferrerPolicy SAME_ORIGIN
The "same-origin" policy specifies that a request’s full referrerURL is sent as referrer information when making same-origin-referrer requests.
Cross-origin-referrer requests, on the other hand, will contain no referrer information. A Referer HTTP header will not be sent.
-
ORIGIN
public static final EHCReferrerPolicy ORIGIN
The "origin" policy specifies that only the ASCII serialization of the request’s referrerURL is sent as referrer information when making both same-origin-referrer requests and cross-origin-referrer requests.
-
STRICT_ORIGIN
public static final EHCReferrerPolicy STRICT_ORIGIN
The "strict-origin" policy sends the ASCII serialization of the origin of the referrerURL for requests:- whose referrerURL and current URL are both potentially trustworthy URLs, or
- whose referrerURL is a non-potentially trustworthy URL.
-
ORIGIN_WHEN_CROSS_ORIGIN
public static final EHCReferrerPolicy ORIGIN_WHEN_CROSS_ORIGIN
The "origin-when-cross-origin" policy specifies that a request’s full referrerURL is sent as referrer information when making same-origin-referrer requests, and only the ASCII serialization of the origin of the request’s referrerURL is sent as referrer information when making cross-origin-referrer requests.
-
STRICT_ORIGIN_WHEN_CROSS_ORIGIN
public static final EHCReferrerPolicy STRICT_ORIGIN_WHEN_CROSS_ORIGIN
The "strict-origin-when-cross-origin" policy specifies that a request’s full referrerURL is sent as referrer information when making same-origin-referrer requests, and only the ASCII serialization of the origin of the request’s referrerURL when making cross-origin-referrer requests:- whose referrerURL and current URL are both potentially trustworthy URLs, or
- whose referrerURL is a non-potentially trustworthy URL.
-
UNSAFE_URL
public static final EHCReferrerPolicy UNSAFE_URL
The "unsafe-url" policy specifies that a request’s full referrerURL is sent along for both same-origin-referrer requests and cross-origin-referrer requests.
-
-
Field Detail
-
DEFAULT
@Nonnull public static final EHCReferrerPolicy DEFAULT
Default policy: strict-origin-when-cross-origin
-
-
Method Detail
-
values
public static EHCReferrerPolicy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (EHCReferrerPolicy c : EHCReferrerPolicy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static EHCReferrerPolicy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
getAttrValue
@Nonnull @Nonempty public String getAttrValue()
- Specified by:
getAttrValuein interfacecom.helger.xml.microdom.IHasAttributeValue
-
getFromAttrValueOrNull
@Nullable public static EHCReferrerPolicy getFromAttrValueOrNull(@Nullable String sAttrValue)
-
-