Class FeaturePolicyHeaderWriter

  • All Implemented Interfaces:
    HeaderWriter

    public final class FeaturePolicyHeaderWriter
    extends java.lang.Object
    implements HeaderWriter
    Provides support for Feature Policy.

    Feature 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 feature policy contains a set of security policy directives, each responsible for declaring the restrictions for a particular feature type.

    Since:
    5.1
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setPolicyDirectives​(java.lang.String policyDirectives)
      Set the security policy directive(s) to be used in the response header.
      java.lang.String toString()  
      void writeHeaders​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Create a Header instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FeaturePolicyHeaderWriter

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

      • 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
      • setPolicyDirectives

        public void setPolicyDirectives​(java.lang.String policyDirectives)
        Set the security policy directive(s) to be used in the response header.
        Parameters:
        policyDirectives - the security policy directive(s)
        Throws:
        java.lang.IllegalArgumentException - if policyDirectives is null or empty
      • toString

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