Package play.mvc
Class Http.CookieBuilder
java.lang.Object
play.mvc.Http.CookieBuilder
- Enclosing class:
- Http
-
Method Summary
Modifier and TypeMethodDescriptionbuild()withDomain(String domain) withHttpOnly(boolean httpOnly) withMaxAge(Duration maxAge) Set the maximum age of the cookie.withSameSite(Http.Cookie.SameSite sameSite) withSecure(boolean secure)
-
Method Details
-
withName
- Parameters:
name- The name of the cookie- Returns:
- the cookie builder with the new name
-
withValue
- Parameters:
value- The value of the cookie- Returns:
- the cookie builder with the new value
-
withMaxAge
Set the maximum age of the cookie.For example, to set a maxAge of 40 days:
builder.withMaxAge(Duration.of(40, ChronoUnit.DAYS))- Parameters:
maxAge- a duration representing the maximum age of the cookie. Will be truncated to the nearest second.- Returns:
- the cookie builder with the new maxAge
-
withPath
- Parameters:
path- The path of the cookie- Returns:
- the cookie builder with the new path
-
withDomain
- Parameters:
domain- The domain of the cookie- Returns:
- the cookie builder with the new domain
-
withSecure
- Parameters:
secure- specify if the cookie is secure- Returns:
- the cookie builder with the new is secure flag
-
withHttpOnly
- Parameters:
httpOnly- specify if the cookie is httpOnly- Returns:
- the cookie builder with the new is httpOnly flag
-
withSameSite
- Parameters:
sameSite- specify if the cookie is SameSite- Returns:
- the cookie builder with the new SameSite flag
-
build
- Returns:
- a new cookie with the current builder parameters
-