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 |
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 cookiepublic Http.CookieBuilder withMaxAge(java.time.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(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()