Modifier and Type | Method and Description |
---|---|
Http.Cookie |
build() |
Http.CookieBuilder |
withDomain(String domain) |
Http.CookieBuilder |
withHttpOnly(boolean httpOnly) |
Http.CookieBuilder |
withMaxAge(Duration maxAge)
Set the maximum age of the cookie.
|
Http.CookieBuilder |
withName(String name) |
Http.CookieBuilder |
withPath(String path) |
Http.CookieBuilder |
withSameSite(Http.Cookie.SameSite sameSite) |
Http.CookieBuilder |
withSecure(boolean secure) |
Http.CookieBuilder |
withValue(String value) |
public Http.CookieBuilder withName(String name)
name
- The name of the cookiepublic Http.CookieBuilder withValue(String value)
value
- The value of the cookiepublic Http.CookieBuilder withMaxAge(Duration maxAge)
For example, to set a maxAge of 40 days:
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(String path)
path
- The path of the cookiepublic Http.CookieBuilder withDomain(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()