Interface OptOutService


public interface OptOutService

The @{code OptOutService} provides the names of cookies/headers that represent the user's choice of "opting out", i.e. not wanting to be tracked by means of cookies. The service also provides the names of white-listed cookies and a convenience method to determine whether a given request is opted out.

This service is intended to be used by applications for the purpose of identifying opted-out requests and change behavior regarding the setting of cookies according to the opt-out status and / or white-list.

  • Method Summary

    Modifier and Type
    Method
    Description
    A configured collection of names of cookies that a client can set to opt-out of tracking.
    A map of name/value pairs of HTTP headers that a client can set to opt-out of tracking.
    A collection of names of cookies that are still allowed by configuration to be set regardless of the client opting out.
    boolean
    Determines whether the request contains any cookies or headers that match any of the configured opt-out cookies or headers.
  • Method Details

    • getCookieNames

      Collection<String> getCookieNames()
      A configured collection of names of cookies that a client can set to opt-out of tracking.
      Returns:
      An unordered Collection representing the cookie names.
    • getHeaders

      Map<String,String> getHeaders()
      A map of name/value pairs of HTTP headers that a client can set to opt-out of tracking.
      Returns:
      A Map representing the configured header name/value pairs.
    • getWhitelistCookieNames

      Collection<String> getWhitelistCookieNames()
      A collection of names of cookies that are still allowed by configuration to be set regardless of the client opting out.
      Returns:
      An unordered Collection representing the cookie names.
    • isOptedOut

      boolean isOptedOut(HttpServletRequest request)
      Determines whether the request contains any cookies or headers that match any of the configured opt-out cookies or headers. In the case of cookies, the simple existence of the cookie is enough to opt-out. In the case of headers, the header-value must correspond to the configured value.
      Parameters:
      request - The request to check.
      Returns:
      true if the request contains any of the cookies/headers indicated via getCookieNames() or getHeaders().