final case class Cookie[T](name: String, content: String, target: Type[T]) extends Product with Serializable
Cookie is an immutable and type-safe representation of an HTTP cookie. It can
be of type types viz. Cookie[Request]
and Cookie[Response]
.
Cookie[Request]
is only available in the Request
object and
Cookie[Response]
is only available in the Response
object.
- Self Type
- Cookie[T]
- Alphabetic
- By Inheritance
- Cookie
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- val content: String
- def domain(implicit ev: =:=[T, Response]): Option[String]
Gets the cookie's Domain attribute.
- def encode(implicit ev: CookieEncoder[T]): Either[Exception, String]
Gets the cookie's Expires attribute.
- def encode(validate: Boolean)(implicit ev: CookieEncoder[T]): Either[Exception, String]
Encodes the cookie to a string.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def isHttpOnly(implicit ev: =:=[T, Response]): Boolean
Returns true if the cookie is allowed over https only
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isSecure(implicit ev: =:=[T, Response]): Boolean
Returns true if the cookie is allowed over secure connections
- def maxAge(implicit ev: =:=[T, Response]): Option[zio.Duration]
- val name: String
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def path(implicit ev: =:=[T, Response]): Option[Path]
Returns the path of the cookie
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def sameSite(implicit ev: =:=[T, Response]): Option[SameSite]
Returns the same-site setting for this cookie.
- def sign(secret: String)(implicit ev: =:=[T, Response]): Cookie[T]
Signs cookie content with a secret and returns a signed cookie.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val target: Type[T]
- def toRequest: Cookie[Request]
Converts cookie to a request cookie.
- def toResponse(domain: Option[String] = None, path: Option[Path] = None, isSecure: Boolean = false, isHttpOnly: Boolean = false, maxAge: Option[Long] = None, sameSite: Option[SameSite] = None): Cookie[Response]
Converts cookie to a response cookie.
- def toResponse: Cookie[Response]
Converts cookie to a response cookie.
- def unSign(secret: String)(implicit ev: =:=[T, Request]): Option[Cookie[T]]
Un-signs cookie content with a secret and returns an unsigned cookie.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withContent(content: String): Cookie[T]
Sets content in cookie
- def withDomain(domain: String)(implicit ev: =:=[T, Response]): Cookie[Response]
Sets domain in cookie
- def withHttpOnly(implicit ev: =:=[T, Response]): Cookie[Response]
Sets httpOnly in cookie
- def withHttpOnly(httpOnly: Boolean)(implicit ev: =:=[T, Response]): Cookie[Response]
Sets httpOnly in cookie
- def withMaxAge(seconds: Long)(implicit ev: =:=[T, Response]): Cookie[Response]
Sets maxAge of the cookie
- def withMaxAge(maxAge: zio.Duration)(implicit ev: =:=[T, Response]): Cookie[Response]
Sets maxAge of the cookie
- def withName(name: String): Cookie[T]
Sets name of the cookie
- def withPath(path: Path)(implicit ev: =:=[T, Response]): Cookie[Response]
Sets path of the cookie
- def withSameSite(sameSite: SameSite)(implicit ev: =:=[T, Response]): Cookie[Response]
Sets sameSite of the cookie
- def withSecure(implicit ev: =:=[T, Response]): Cookie[Response]
Sets secure flag of the cookie
- def withSecure(secure: Boolean)(implicit ev: =:=[T, Response]): Cookie[Response]
Sets secure flag of the cookie