public static class Http.CookieBuilder
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
Http.Cookie |
build() |
Http.CookieBuilder |
withDomain(java.lang.String domain) |
Http.CookieBuilder |
withHttpOnly(boolean httpOnly) |
Http.CookieBuilder |
withMaxAge(java.time.Duration maxAge)
Set the maximum age of the cookie.
|
Http.CookieBuilder |
withMaxAge(java.lang.Integer maxAge)
Deprecated.
As of 2.6.0, use withMaxAge(Duration) instead.
|
Http.CookieBuilder |
withName(java.lang.String name) |
Http.CookieBuilder |
withPath(java.lang.String path) |
Http.CookieBuilder |
withSameSite(Http.Cookie.SameSite sameSite) |
Http.CookieBuilder |
withSecure(boolean secure) |
Http.CookieBuilder |
withValue(java.lang.String value) |
public Http.CookieBuilder withName(java.lang.String name)
name
- The name of the cookiepublic Http.CookieBuilder withValue(java.lang.String value)
value
- The value of the cookie@Deprecated public Http.CookieBuilder withMaxAge(java.lang.Integer maxAge)
maxAge
- The maxAge of the cookie in secondspublic Http.CookieBuilder withMaxAge(java.time.Duration maxAge)
builder.withMaxAge(Duration.of(40, ChronoUnit.DAYS))
maxAge
- a duration representing the maximum age of the cookie. Will be truncated to the nearest second.public Http.CookieBuilder withPath(java.lang.String path)
path
- The path of the cookiepublic Http.CookieBuilder withDomain(java.lang.String domain)
domain
- The domain of the cookiepublic Http.CookieBuilder withSecure(boolean secure)
secure
- specify if the cookie is securepublic Http.CookieBuilder withHttpOnly(boolean httpOnly)
httpOnly
- specify if the cookie is httpOnlypublic Http.CookieBuilder withSameSite(Http.Cookie.SameSite sameSite)
sameSite
- specify if the cookie is SameSitepublic Http.Cookie build()