Class ClearSiteDataHeaderWriter

  • All Implemented Interfaces:
    HeaderWriter

    public final class ClearSiteDataHeaderWriter
    extends java.lang.Object
    implements HeaderWriter
    Provides support for Clear Site Data.

    Developers may instruct a user agent to clear various types of relevant data by delivering a Clear-Site-Data HTTP response header in response to a request.

    Due to Incomplete Clearing section the header is only applied if the request is secure.

    Since:
    5.2
    • Constructor Detail

      • ClearSiteDataHeaderWriter

        public ClearSiteDataHeaderWriter​(ClearSiteDataHeaderWriter.Directive... directives)

        Creates a new instance of ClearSiteDataHeaderWriter with given sources. The constructor also initializes requestMatcher with a new instance of SecureRequestMatcher to ensure that header is only applied if and when the request is secure as per the Incomplete Clearing section.

        Parameters:
        directives - (i.e. "cache", "cookies", "storage", "executionContexts" or "*")
        Throws:
        java.lang.IllegalArgumentException - if sources 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
      • toString

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