java.lang.Object
org.htmlunit.csp.PolicyList
Represents a list of Content Security Policies parsed from a comma-separated
serialized CSP list.
A serialized CSP list (e.g. the value of a Content-Security-Policy
HTTP header) may contain multiple policies separated by commas. Each policy
is parsed independently, and a resource is blocked if any policy
in the list blocks it.
Instances are created by
Policy.parseSerializedCSPList(String, Policy.PolicyListErrorConsumer).
Empty policies (those with no directives) are omitted during parsing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of the policies associated with this object.toString()Serializes this policy list back to its string representation.
-
Constructor Details
-
PolicyList
Ctor.- Parameters:
policies- the list of parsedPolicyinstances (empty policies excluded)
-
-
Method Details
-
getPolicies
Returns a copy of the policies associated with this object.The returned list is a defensive copy, so modifications to it do not affect the internal collection of policies.
- Returns:
- a new
Listcontaining all policies
-
toString
Serializes this policy list back to its string representation.Individual policies are separated by
", ". Each policy is serialized usingPolicy.toString().
-