Class PermissionsPolicyHeaderWriter

  • All Implemented Interfaces:
    HeaderWriter

    public final class PermissionsPolicyHeaderWriter
    extends java.lang.Object
    implements HeaderWriter
    Provides support for Permisisons Policy.

    Permissions Policy allows web developers to selectively enable, disable, and modify the behavior of certain APIs and web features in the browser.

    A declaration of a permissions policy contains a set of security policies, each responsible for declaring the restrictions for a particular feature type.

    Since:
    5.5
    • Constructor Detail

      • PermissionsPolicyHeaderWriter

        public PermissionsPolicyHeaderWriter​(java.lang.String policy)
        Create a new instance of PermissionsPolicyHeaderWriter with supplied security policy.
        Parameters:
        policy - the security policy
        Throws:
        java.lang.IllegalArgumentException - if policy is null or empty
    • Method Detail

      • setPolicy

        public void setPolicy​(java.lang.String policy)
        Sets the policy to be used in the response header.
        Parameters:
        policy - a permissions policy
        Throws:
        java.lang.IllegalArgumentException - if policy is null
      • writeHeaders

        public void writeHeaders​(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
        Description copied from interface: HeaderWriter
        Create a Header instance.
        Specified by:
        writeHeaders in interface HeaderWriter
        Parameters:
        request - the request
        response - the response
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object