Package java.net

Interface CookiePolicy


  • public interface CookiePolicy
    CookiePolicy has three pre-defined policy. They are ACCEPT_ALL, ACCEPT_NONE and ACCEPT_ORIGINAL_SERVER respectively. They are used to decide which cookies should be accepted and which should not be. See RFC 2965 sections 3.3 and 7 for more detail.
    Since:
    1.6
    • Field Detail

      • ACCEPT_ALL

        static final CookiePolicy ACCEPT_ALL
        A pre-defined policy, accepts all cookies.
      • ACCEPT_NONE

        static final CookiePolicy ACCEPT_NONE
        A pre-defined policy, accepts no cookies at all.
      • ACCEPT_ORIGINAL_SERVER

        static final CookiePolicy ACCEPT_ORIGINAL_SERVER
        A pre-defined policy, only accepts cookies from original server.
    • Method Detail

      • shouldAccept

        boolean shouldAccept​(URI uri,
                             HttpCookie cookie)
        This method is used to determine whether or not the specified cookie should be accepted.
        Parameters:
        uri - the URI to used to determine acceptability
        cookie - the HttpCookie to be determined
        Returns:
        true if this cookie should be accepted; false otherwise