Interface Cookie

All Superinterfaces:
Comparable
All Known Implementing Classes:
CookieImpl

public interface Cookie extends Comparable
A HTTP cookie.
Author:
Stuart Douglas
See Also:
  • Field Details

  • Method Details

    • getName

      String getName()
    • getValue

      String getValue()
    • setValue

      Cookie setValue(String value)
    • getPath

      String getPath()
    • setPath

      Cookie setPath(String path)
    • getDomain

      String getDomain()
    • setDomain

      Cookie setDomain(String domain)
    • getMaxAge

      Integer getMaxAge()
    • setMaxAge

      Cookie setMaxAge(Integer maxAge)
    • isDiscard

      boolean isDiscard()
    • setDiscard

      Cookie setDiscard(boolean discard)
    • isSecure

      boolean isSecure()
    • setSecure

      Cookie setSecure(boolean secure)
    • getVersion

      int getVersion()
    • setVersion

      Cookie setVersion(int version)
    • isHttpOnly

      boolean isHttpOnly()
    • setHttpOnly

      Cookie setHttpOnly(boolean httpOnly)
    • getExpires

      Date getExpires()
    • setExpires

      Cookie setExpires(Date expires)
    • getComment

      String getComment()
    • setComment

      Cookie setComment(String comment)
    • isSameSite

      default boolean isSameSite()
    • setSameSite

      @Deprecated(forRemoval=true) default Cookie setSameSite(boolean sameSite)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getSameSiteMode

      default String getSameSiteMode()
    • setSameSiteMode

      default Cookie setSameSiteMode(String mode)
    • getAttribute

      default String getAttribute(String name)
      Returns the attribute associated with the name or null if no attribute is associated with the name.
      Parameters:
      name - the name of the attribute
      Returns:
      the value or null if not found
    • setAttribute

      default Cookie setAttribute(String name, String value)
      Sets an attribute for the cookie. If the value is null, the attribute is removed. If the value is not null, the attribute is added to the attributes for this cookie. If name match pre-existing attribute, like "COOKIE_PATH_ATTR" it will override that value
      Parameters:
      name - the name of the attribute
      value - the value of the attribute or null to remove it
      Returns:
      this cookie
    • getAttributes

      default Map<String,String> getAttributes()
      Returns an unmodifiable map of the attributes associated with this cookie.
      Returns:
      an unmodifiable map of the attributes
    • compareTo

      default int compareTo(Object other)
      Specified by:
      compareTo in interface Comparable