Class HttpCookie

java.lang.Object
org.eclipse.jetty.http.HttpCookie

public class HttpCookie extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Returns:
      the cookie name
    • getValue

      public String getValue()
      Returns:
      the cookie value
    • getComment

      public String getComment()
      Returns:
      the cookie comment
    • getDomain

      public String getDomain()
      Returns:
      the cookie domain
    • getMaxAge

      public long getMaxAge()
      Returns:
      the cookie max age in seconds
    • getPath

      public String getPath()
      Returns:
      the cookie path
    • isSecure

      public boolean isSecure()
      Returns:
      whether the cookie is valid for secure domains
    • getVersion

      public int getVersion()
      Returns:
      the cookie version
    • getSameSite

      public HttpCookie.SameSite getSameSite()
      Returns:
      the cookie SameSite enum attribute
    • isHttpOnly

      public boolean isHttpOnly()
      Returns:
      whether the cookie is valid for the http protocol only
    • isExpired

      public boolean isExpired(long timeNanos)
      Parameters:
      timeNanos - the time to check for cookie expiration, in nanoseconds
      Returns:
      whether the cookie is expired by the given time
    • isPartitioned

      public boolean isPartitioned()
      Returns:
      whether this cookie is partitioned
    • asString

      public String asString()
      Returns:
      a string representation of this cookie
    • getSetCookie

      public String getSetCookie(CookieCompliance compliance)
    • getRFC2965SetCookie

      public String getRFC2965SetCookie()
    • getRFC6265SetCookie

      public String getRFC6265SetCookie()
    • isHttpOnlyInComment

      public static boolean isHttpOnlyInComment(String comment)
    • isPartitionedInComment

      public static boolean isPartitionedInComment(String comment)
    • getSameSiteFromComment

      public static HttpCookie.SameSite getSameSiteFromComment(String comment)
    • getSameSiteDefault

      public static HttpCookie.SameSite getSameSiteDefault(Attributes contextAttributes)
      Get the default value for SameSite cookie attribute, if one has been set for the given context.
      Parameters:
      contextAttributes - the context to check for default SameSite value
      Returns:
      the default SameSite value or null if one does not exist
      Throws:
      IllegalStateException - if the default value is not a permitted value
    • getCommentWithoutAttributes

      public static String getCommentWithoutAttributes(String comment)
    • getCommentWithAttributes

      public static String getCommentWithAttributes(String comment, boolean httpOnly, HttpCookie.SameSite sameSite)
    • getCommentWithAttributes

      public static String getCommentWithAttributes(String comment, boolean httpOnly, HttpCookie.SameSite sameSite, boolean partitioned)