Class SetCookie

java.lang.Object
io.helidon.http.SetCookie

public class SetCookie extends Object
Represents 'Set-Cookie' header value specified by RFC6265.

It is mutable and fluent builder.

  • Method Details

    • builder

      public static SetCookie.Builder builder(String name, String value)
      Creates a new fluent API builder.
      Parameters:
      name - a cookie name.
      value - a cookie value.
      Returns:
      a new fluent API builder
    • parse

      public static SetCookie parse(String setCookie)
      Parses new instance of SetCookie from the String representation.
      Parameters:
      setCookie - string representation
      Returns:
      new instance
    • create

      public static SetCookie create(String name, String value)
      Creates new instance.
      Parameters:
      name - a cookie name.
      value - a cookie value.
      Returns:
      a new instance with just the name and value configured
    • name

      public String name()
      Name of the cookie.
      Returns:
      the name.
    • value

      public String value()
      Value of the cookie.
      Returns:
      value
    • expires

      public Optional<ZonedDateTime> expires()
      Expiration of cookie.
      Returns:
      expiration if defined
    • maxAge

      public Optional<Duration> maxAge()
      Max age of cookie.
      Returns:
      max age if defined
    • domain

      public Optional<String> domain()
      Domain of cookie.
      Returns:
      domain if defined
    • path

      public Optional<String> path()
      Path of cookie.
      Returns:
      path if defined
    • secure

      public boolean secure()
      Secure attribute of cookie.
      Returns:
      whether secure was set
    • httpOnly

      public boolean httpOnly()
      HttpOnly attribute of cookie.
      Returns:
      whether HttpOnly was set
    • sameSite

      public Optional<SetCookie.SameSite> sameSite()
      Same site attribute of cookie.
      Returns:
      same site if defined
    • text

      public String text()
      Text representation of this cookie.
      Returns:
      cookie text
    • toString

      public String toString()
      Returns content of this instance as a 'Set-Cookie:' header value specified by RFC6265.
      Overrides:
      toString in class Object
      Returns:
      a 'Set-Cookie:' header value.