public abstract class CookieBuilder extends Object
Cookies
service.Modifier and Type | Field and Description |
---|---|
protected String |
domain |
protected Integer |
maxAge |
protected String |
name |
protected String |
path |
protected Boolean |
secure |
protected String |
value |
Modifier | Constructor and Description |
---|---|
protected |
CookieBuilder(String name,
String value)
Initialize a new CookieBuilder
|
Modifier and Type | Method and Description |
---|---|
abstract void |
delete()
Deletes the cookie.
|
CookieBuilder |
setDomain(String domain)
Set the domain for the cookie to be created.
|
CookieBuilder |
setMaxAge(int maxAge)
Set how long the cookie should live.
|
CookieBuilder |
setPath(String path)
Set the path for the cookie to be created.
|
CookieBuilder |
setSecure(boolean secure)
Set the cookie's secure mode.
|
abstract void |
write()
Sets defaults and writes the cookie to the client.
|
protected CookieBuilder(String name, String value)
name
- the name of the resulting cookievalue
- the value of the resulting cookiepublic CookieBuilder setPath(String path)
Request.getContextPath()
.path
- the path for the cookieCookieBuilder
public CookieBuilder setDomain(String domain)
domain
- the domain for the cookieCookieBuilder
public CookieBuilder setMaxAge(int maxAge)
0
deletes a cookie, a value of
-1
deletes a cookie upon closing the browser. The default is defined by
the symbol org.apache.tapestry5.default-cookie-max-age
. The factory default for
this value is the equivalent of one week.maxAge
- the cookie's maximum age in secondsCookieBuilder
public CookieBuilder setSecure(boolean secure)
Request.isSecure()
.secure
- whether to send the cookie over a secure channel onlyCookieBuilder
public abstract void write()
public abstract void delete()
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.