Package play.mvc
Class Http.CookieBuilder
- Object
-
- play.mvc.Http.CookieBuilder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Http.Cookiebuild()Http.CookieBuilderwithDomain(String domain)Http.CookieBuilderwithHttpOnly(boolean httpOnly)Http.CookieBuilderwithMaxAge(Duration maxAge)Set the maximum age of the cookie.Http.CookieBuilderwithName(String name)Http.CookieBuilderwithPath(String path)Http.CookieBuilderwithSameSite(Http.Cookie.SameSite sameSite)Http.CookieBuilderwithSecure(boolean secure)Http.CookieBuilderwithValue(String value)
-
-
-
Method Detail
-
withName
public Http.CookieBuilder withName(String name)
- Parameters:
name- The name of the cookie- Returns:
- the cookie builder with the new name
-
withValue
public Http.CookieBuilder withValue(String value)
- Parameters:
value- The value of the cookie- Returns:
- the cookie builder with the new value
-
withMaxAge
public Http.CookieBuilder withMaxAge(Duration maxAge)
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
public Http.CookieBuilder withPath(String path)
- Parameters:
path- The path of the cookie- Returns:
- the cookie builder with the new path
-
withDomain
public Http.CookieBuilder withDomain(String domain)
- Parameters:
domain- The domain of the cookie- Returns:
- the cookie builder with the new domain
-
withSecure
public Http.CookieBuilder withSecure(boolean secure)
- Parameters:
secure- specify if the cookie is secure- Returns:
- the cookie builder with the new is secure flag
-
withHttpOnly
public Http.CookieBuilder withHttpOnly(boolean httpOnly)
- Parameters:
httpOnly- specify if the cookie is httpOnly- Returns:
- the cookie builder with the new is httpOnly flag
-
withSameSite
public Http.CookieBuilder withSameSite(Http.Cookie.SameSite sameSite)
- Parameters:
sameSite- specify if the cookie is SameSite- Returns:
- the cookie builder with the new SameSite flag
-
build
public Http.Cookie build()
- Returns:
- a new cookie with the current builder parameters
-
-