|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.service.request.Cookie
public final class Cookie
is a small amount of information stored by the client's browser.
A Cookie may for example be used to store a users personal
preferences for an application, if they need to be available without
requiring the user to log in. The use of Cookies to store
session data is strongly discuraged. Use the ServiceSession
instead.
This class is a facade to the javax.servlet.http.Cookie
implementation of the Servlet-API.
Attention: Cookies are immutable and cannot be
re-added to the ServiceRequest.
Cookie, ServiceSession| Nested Class Summary | |
|---|---|
static class |
Cookie.ImmutableException
an exception to be thrown upon attempts to make modifications to a Cookie which is read from the ServiceRequest. |
| Constructor Summary | |
|---|---|
protected |
Cookie(javax.servlet.http.Cookie c)
used by ServiceRequest. |
|
Cookie(java.lang.String name,
java.lang.String value,
java.lang.String path)
constructs a Cookie with a specified name,
value and path according to the Netscape Cookie
specification with a maximum age of -1. |
|
Cookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain)
constructs a Cookie with a specifiedname,
value, path and domain according to the
Netscape Cookie specification with a maximum age of -1. |
| Method Summary | |
|---|---|
protected javax.servlet.http.Cookie |
getCookie()
returns the underlying cookie. |
java.lang.String |
getName()
get the name of the Cookie. |
Cookie |
getNewCookie(java.lang.String path)
returns a new Cookie with the same values for name
and value as the current Cookie and the given
path. |
Cookie |
getNewCookie(java.lang.String path,
java.lang.String domain)
returns a new Cookie with the same values for name
and value as the current Cookie and the given
path. |
java.lang.String |
getValue()
get the value of the Cookie. |
void |
invalidate(ServiceRequest request)
invalidates the Cookie. |
boolean |
isReadOnly()
returns whether the Cookie is read-only. |
Cookie |
setDomain(java.lang.String domain)
set the domain of the Cookie. |
Cookie |
setMaxAge(int maxAge)
get the maximum age of the Cookie. |
void |
setPath(java.lang.String uri)
sets the path of the Cookie. |
Cookie |
setSecure(boolean secure)
indicate to the browser whether the Cookie shall only be
sent using a secure protocol (true). |
void |
setSessionCookie()
sets the Cookie to be a session-cookie. |
Cookie |
setValue(java.lang.String value)
set the value of the Cookie. |
java.lang.String |
toString()
returns a string representation of the cookie. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Cookie(javax.servlet.http.Cookie c)
ServiceRequest.
c - the http cookie.
public Cookie(java.lang.String name,
java.lang.String value,
java.lang.String path)
Cookie with a specified name,
value and path according to the Netscape Cookie
specification with a maximum age of -1.
If you need a Cookie that lasts longer than the current
browser session, change the maximum age with setMaxAge(int).
name - the name of the cookievalue - the value of the cookiepath - the cookie pathsetMaxAge(int)
public Cookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain)
Cookie with a specifiedname,
value, path and domain according to the
Netscape Cookie specification with a maximum age of -1.
If you need a Cookie that lasts longer than the current
browser session, change the maximum age with setMaxAge(int).
name - the name of the cookievalue - the value of the cookiepath - the cookie pathdomain - the cookie domainsetMaxAge(int)| Method Detail |
|---|
public Cookie getNewCookie(java.lang.String path)
Cookie with the same values for name
and value as the current Cookie and the given
path.
path - the path for the new Cookie
Cookie
public Cookie getNewCookie(java.lang.String path,
java.lang.String domain)
Cookie with the same values for name
and value as the current Cookie and the given
path.
path - the path for the new Cookiedomain - the domain for the new Cookie
Cookiepublic java.lang.String getName()
Cookie.
getName in interface INamedCookiepublic java.lang.String getValue()
Cookie.
Cookiepublic Cookie setDomain(java.lang.String domain)
Cookie.
domain - the domain to be set
Cookie modifiedCookie.setDomain(java.lang.String)public void setPath(java.lang.String uri)
uri - the pathCookie.setPath(String)public Cookie setMaxAge(int maxAge)
Cookie.
maxAge - the maximum age to be set
Cookie modifiedCookie.setMaxAge(int)public Cookie setSecure(boolean secure)
Cookie shall only be
sent using a secure protocol (true).
secure - the security flag to be set
Cookie modifiedCookie.setSecure(boolean)public Cookie setValue(java.lang.String value)
Cookie.
value - the value to be set
Cookie modifiedCookie.setValue(java.lang.String)public void invalidate(ServiceRequest request)
Cookie.
This is a convenience method which acutally combines
setMaxAge(int) with a value of 0 (zero) and
ServiceRequest.addCookie(Cookie) with this instance
being the added cookie.
request - the current request to send the invalidation to the clientpublic void setSessionCookie()
Cookie to be a session-cookie.
Actually this is just a more readable substitution for
setMaxAge(int) with a value of -1.
protected javax.servlet.http.Cookie getCookie()
public boolean isReadOnly()
Cookie is read-only.
true, if and only if the Cookie is from
the underlying request and thus cannot be modified. Otherwise
false.public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||