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 Summary

    Fields
    Modifier and Type Field Description
    static CookiePolicy ACCEPT_ALL
    A pre-defined policy, accepts all cookies.
    static CookiePolicy ACCEPT_NONE
    A pre-defined policy, accepts no cookies at all.
    static CookiePolicy ACCEPT_ORIGINAL_SERVER
    A pre-defined policy, only accepts cookies from original server.
  • Method Summary

    Modifier and Type Method Description
    boolean shouldAccept​(URI uri, HttpCookie cookie)
    This method is used to determine whether or not the specified cookie should be accepted.
  • Field Details

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

    • 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