Class CookieBuilder

java.lang.Object
com.linecorp.armeria.common.CookieBuilder

public final class CookieBuilder extends Object
Builds a Cookie.
  • Method Details

    • name

      public CookieBuilder name(String name)
      Sets the name of the Cookie.
    • value

      public CookieBuilder value(String value)
      Sets the value of the Cookie.
    • valueQuoted

      public CookieBuilder valueQuoted(boolean valueQuoted)
      Sets whether the value of the Cookie needs to be wrapped with double quotes when encoding. If unspecified, the Cookie will not be wrapped with double quotes.
    • domain

      public CookieBuilder domain(String domain)
      Sets the domain of the Cookie.
    • path

      public CookieBuilder path(String path)
      Sets the path of the Cookie.
    • maxAge

      public CookieBuilder maxAge(long maxAge)
      Sets the maximum age of the Cookie in seconds. If an age of 0 is specified, the Cookie will be automatically removed by browser because it will expire immediately. If Cookie.UNDEFINED_MAX_AGE is specified, this Cookie will be removed when the browser is closed. If unspecified, Cookie.UNDEFINED_MAX_AGE will be used.
      Parameters:
      maxAge - The maximum age of this Cookie in seconds
    • secure

      public CookieBuilder secure(boolean secure)
      Sets the security status of the Cookie. If unspecified, false will be used.
    • httpOnly

      public CookieBuilder httpOnly(boolean httpOnly)
      Sets whether the Cookie is HTTP only. If true, the Cookie cannot be accessed by a client side script. However, this works only if the browser supports it. For more information, please look here. If unspecified, false will be used.
    • hostOnly

      public CookieBuilder hostOnly(boolean hostOnly)
      Sets whether the Cookie should only match its original host in domain matching.
    • sameSite

      public CookieBuilder sameSite(String sameSite)
      Sets the SameSite attribute of the Cookie. The value is supposed to be one of "Lax", "Strict" or "None". Note that this attribute is server-side only.
    • build

      public Cookie build()
      Returns a newly created Cookie with the properties set so far.