|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.util.CookieGenerator
public class CookieGenerator
Helper class for cookie generation, carrying cookie descriptor settings as bean properties and being able to add and remove cookie to/from a given response.
Can serve as base class for components that generate specific cookies, like CookieLocaleResolcer and CookieThemeResolver.
addCookie(javax.servlet.http.HttpServletResponse, java.lang.String)
,
removeCookie(javax.servlet.http.HttpServletResponse)
,
CookieLocaleResolver
,
CookieThemeResolver
Field Summary | |
---|---|
static int |
DEFAULT_COOKIE_MAX_AGE
Default maximum age of cookies: maximum integer value, i.e. forever. |
static String |
DEFAULT_COOKIE_PATH
Default path that cookies will be visible to: "/", i.e. the entire server. |
protected Log |
logger
|
Constructor Summary | |
---|---|
CookieGenerator()
|
Method Summary | |
---|---|
void |
addCookie(HttpServletResponse response,
String cookieValue)
Add a cookie with the given value to the response, using the cookie descriptor settings of this generator. |
protected Cookie |
createCookie(String cookieValue)
Create a cookie with the given value, using the cookie descriptor settings of this generator (except for "cookieMaxAge"). |
String |
getCookieDomain()
Return the domain for cookies created by this generator, if any. |
int |
getCookieMaxAge()
Return the maximum age for cookies created by this generator. |
String |
getCookieName()
Return the given name for cookies created by this generator. |
String |
getCookiePath()
Return the path for cookies created by this generator. |
boolean |
isCookieSecure()
Return whether the cookie should only be sent using a secure protocol, such as HTTPS (SSL). |
void |
removeCookie(HttpServletResponse response)
Remove the cookie that this generator describes from the response. |
void |
setCookieDomain(String cookieDomain)
Use the given domain for cookies created by this generator. |
void |
setCookieMaxAge(int cookieMaxAge)
Use the given maximum age (in seconds) for cookies created by this generator. |
void |
setCookieName(String cookieName)
Use the given name for cookies created by this generator. |
void |
setCookiePath(String cookiePath)
Use the given path for cookies created by this generator. |
void |
setCookieSecure(boolean cookieSecure)
Set whether the cookie should only be sent using a secure protocol, such as HTTPS (SSL). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_COOKIE_PATH
public static final int DEFAULT_COOKIE_MAX_AGE
protected final Log logger
Constructor Detail |
---|
public CookieGenerator()
Method Detail |
---|
public void setCookieName(String cookieName)
public String getCookieName()
public void setCookieDomain(String cookieDomain)
public String getCookieDomain()
public void setCookiePath(String cookiePath)
public String getCookiePath()
public void setCookieMaxAge(int cookieMaxAge)
public int getCookieMaxAge()
public void setCookieSecure(boolean cookieSecure)
public boolean isCookieSecure()
public void addCookie(HttpServletResponse response, String cookieValue)
Delegates to createCookie
for cookie creation.
response
- the HTTP response to add the cookie tocookieValue
- the value of the cookie to addsetCookieName(java.lang.String)
,
setCookieDomain(java.lang.String)
,
setCookiePath(java.lang.String)
,
setCookieMaxAge(int)
,
createCookie(java.lang.String)
public void removeCookie(HttpServletResponse response)
Delegates to createCookie
for cookie creation.
response
- the HTTP response to remove the cookie fromsetCookieName(java.lang.String)
,
setCookieDomain(java.lang.String)
,
setCookiePath(java.lang.String)
,
createCookie(java.lang.String)
protected Cookie createCookie(String cookieValue)
cookieValue
- the value of the cookie to crate
setCookieName(java.lang.String)
,
setCookieDomain(java.lang.String)
,
setCookiePath(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |