Fluent builder for a single cookie, obtained from HttpWrapper.cookieBuilder(name). Each setter returns the same builder so calls can be chained, and build() adds the finished cookie to the current response. The cookie's SameSite attribute defaults to Strict.

Group: Builders


Methods

value(String value)

Returns: CookieBuilder

Sets the cookie's value.

ParameterDescription
valuethe value to record on the cookie

secure(boolean secure)

Returns: CookieBuilder

Sets whether the cookie is only sent over HTTPS connections.

ParameterDescription
securetrue to mark the cookie secure, false otherwise

expiry(int expiry)

Returns: CookieBuilder

Sets how long, in seconds, the cookie remains valid for.

ParameterDescription
expirythe number of seconds the cookie will remain valid for

path(String path)

Returns: CookieBuilder

Sets the URL path scope the cookie applies to.

ParameterDescription
paththe URL path scope for the cookie

httpOnly(boolean httpOnly)

Returns: CookieBuilder

Sets whether the cookie is hidden from client-side script access.

ParameterDescription
httpOnlytrue to mark the cookie HttpOnly, false otherwise

sameSite(String ss)

Returns: CookieBuilder

Sets the cookie's SameSite attribute, overriding the Strict default.

ParameterDescription
ssthe SameSite value - None, Lax or Strict

build()

Returns: Cookie

Builds the cookie and adds it to the current HTTP response.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.