Class CookiesImpl
-
- org.apache.tapestry5.internal.services.CookiesImpl
-
- All Implemented Interfaces:
Cookies
public class CookiesImpl extends implements Cookies
Implementation of theCookies
service interface.
-
-
Constructor Summary
Constructors Constructor Description CookiesImpl(Request request, CookieSource cookieSource, CookieSink cookieSink, contextPath, long defaultMaxAge)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CookieBuilder
name, value)
Returns a .name)
Returns the value of the first cookie whose name matches.void
name)
Removes a previously written cookie, by writing a new cookie with a maxAge of 0.void
name, value)
Creates or updates a cookie value.void
name, value, int maxAge)
As withCookies.writeCookieValue(String, String)
but an explicit maximum age may be set.void
name, value, path)
As withCookies.writeCookieValue(String, String)
but an explicit path may be set.void
name, value, path, domain)
As withCookies.writeCookieValue(String, String, String)
but an explicit domain and path may be set.void
name, value, domain)
As withCookies.writeCookieValue(String, String)
but an explicit domain may be set.void
name, value, domain, int maxAge)
As withCookies.writeCookieValue(String, String)
but an explicit domain and maximum age may be set.
-
-
-
Constructor Detail
-
CookiesImpl
public CookiesImpl(Request request, CookieSource cookieSource, CookieSink cookieSink, @Symbol("tapestry.context-path") contextPath, @Symbol("tapestry.default-cookie-max-age") @IntermediateType(TimeInterval.class) long defaultMaxAge)
- Parameters:
request
-cookieSource
-cookieSink
-contextPath
-defaultMaxAge
- default cookie expiration time in milliseconds
-
-
Method Detail
-
readCookieValue
public name)
Description copied from interface:Cookies
Returns the value of the first cookie whose name matches. Returns null if no such cookie exists. This method is only aware of cookies that are part of the incoming request; it does not know about additional cookies added since then (viaCookies.writeCookieValue(String, String)
).- Specified by:
readCookieValue
in interfaceCookies
-
writeCookieValue
public void name, value)
Description copied from interface:Cookies
Creates or updates a cookie value. The value is stored using a max age (in seconds) defined by the symbolorg.apache.tapestry5.default-cookie-max-age
. The factory default for this value is the equivalent of one week.- Specified by:
writeCookieValue
in interfaceCookies
-
writeCookieValue
public void name, value, int maxAge)
Description copied from interface:Cookies
As withCookies.writeCookieValue(String, String)
but an explicit maximum age may be set.- Specified by:
writeCookieValue
in interfaceCookies
- Parameters:
name
- the name of the cookievalue
- the value to be stored in the cookiemaxAge
- the maximum age, in seconds, to store the cookie
-
writeCookieValue
public void name, value, path)
Description copied from interface:Cookies
As withCookies.writeCookieValue(String, String)
but an explicit path may be set.- Specified by:
writeCookieValue
in interfaceCookies
-
writeDomainCookieValue
public void name, value, domain)
Description copied from interface:Cookies
As withCookies.writeCookieValue(String, String)
but an explicit domain may be set.- Specified by:
writeDomainCookieValue
in interfaceCookies
-
writeDomainCookieValue
public void name, value, domain, int maxAge)
Description copied from interface:Cookies
As withCookies.writeCookieValue(String, String)
but an explicit domain and maximum age may be set.- Specified by:
writeDomainCookieValue
in interfaceCookies
-
writeCookieValue
public void name, value, path, domain)
Description copied from interface:Cookies
As withCookies.writeCookieValue(String, String, String)
but an explicit domain and path may be set.- Specified by:
writeCookieValue
in interfaceCookies
-
removeCookieValue
public void name)
Description copied from interface:Cookies
Removes a previously written cookie, by writing a new cookie with a maxAge of 0. Only deletes a cookie with the default path and no domain set. For deleting other cookies useCookieBuilder.delete()
. An instance of theCookieBuilder
API can be obtained withCookies.getBuilder(String, String)
.- Specified by:
removeCookieValue
in interfaceCookies
-
getBuilder
public name, value)
Description copied from interface:Cookies
Returns a . The default implementation creates a cookie who's value is stored using a max age (in seconds) defined by the symbolorg.apache.tapestry5.default-cookie-max-age
. The factory default for this value is the equivalent of one week. The default path is the context path (seeRequest.getContextPath()
) of the current Request, the default secure setting is to send the cookie over secure channels only, if the original request was secure (seeRequest.isSecure()
- Specified by:
getBuilder
in interfaceCookies
- Parameters:
name
- the name of the cookievalue
- the value of the cookie- Returns:
- a
CookieBuilder
for setting additional cookie attributes and writing it out
-
-