Package play.mvc
Class Http.Cookie
java.lang.Object
play.mvc.Http.Cookie
- Enclosing class:
- Http
HTTP Cookie
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Cookie
public Cookie(String name, String value, Integer maxAge, String path, String domain, boolean secure, boolean httpOnly, Http.Cookie.SameSite sameSite) Construct a new cookie. Preferbuilder(java.lang.String, java.lang.String)for creating new cookies in your application.- Parameters:
name- Cookie name, must not be nullvalue- Cookie valuemaxAge- Cookie duration in seconds (null for a transient cookie, 0 or less for one that expires now)path- Cookie pathdomain- Cookie domainsecure- Whether the cookie is secured (for HTTPS requests)httpOnly- Whether the cookie is HTTP only (i.e. not accessible from client-side JavaScript code)sameSite- the SameSite attribute for this cookie (for CSRF protection).
-
-
Method Details
-
builder
- Parameters:
name- the cookie builder namevalue- the cookie builder value- Returns:
- the cookie builder with the specified name and value
-
name
- Returns:
- the cookie name
-
value
- Returns:
- the cookie value
-
maxAge
- Returns:
- the cookie expiration date in seconds, null for a transient cookie, a value less than zero for a cookie that expires now
-
path
- Returns:
- the cookie path
-
domain
- Returns:
- the cookie domain, or null if not defined
-
secure
public boolean secure()- Returns:
- wether the cookie is secured, sent only for HTTPS requests
-
httpOnly
public boolean httpOnly()- Returns:
- wether the cookie is HTTP only, i.e. not accessible from client-side JavaScript code
-
sameSite
- Returns:
- the SameSite attribute for this cookie
-
asScala
public play.api.mvc.Cookie asScala()
-