|
|||||||||
| Home >> All >> com >> jcorporate >> expresso >> core >> controller >> [ session overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.jcorporate.expresso.core.controller.session
Interface PersistentSession

- All Superinterfaces:
- java.io.Serializable
- All Known Implementing Classes:
- HTTPPersistentSession, SimplePersistentSession
- public interface PersistentSession
- extends java.io.Serializable
A PersistentSession is simply a place to stash some values between states of a controller object. Different environments may employ different ways of doing this - the simplest being SimplePersistentSession, where a hashtable does all the required work.
The typical way to use a PersistentSession is within a controller object as part of your state handler. You do not instantiate it directly, the controller framework instantiates the appropriate kind of session for you. [Unless you're directly creating a controller yourself, such as in a command line environment, in which case, you would set the session object at say, SimplePersistentSession... if you're getting confused at what is meant by this, ignore it.]
Example Usage:
void protected runMyState(ControllerRequest request, ControllerResponse response) throws ControllerException {
PersistentSesssion session = request.getSession();
//Set an attribute that exists only for the current request.
session.setAttribute("RequestAttribute", "Controller Was Executed");
//Set an attribute that exists for the entire session
session.setPersistentAttribute("SessionAttribute","Customer Has Logged In");
//Set an attribute that persists across requests. [In HTTP sets a cookie]
session.setClientAttribute("ACookie", "Cookie Data That May Get Encrypted");
- Since:
- Expresso 4.0
| Method Summary | |
java.lang.Object |
getAttribute(java.lang.String attribName)
Retrieves the object from the request context. |
java.util.Enumeration |
getAttributeNames()
Retrieves all attribute names in the request context. |
java.lang.String |
getClientAttribute(java.lang.String attribName)
Retrieves a value of a cookie set on the client's system. |
java.util.Enumeration |
getPeristentAttributeNames()
Retrieves all attribute names from the session context. |
java.lang.Object |
getPersistentAttribute(java.lang.String attribName)
Retrieves the object from the session context. |
void |
invalidate()
Clear out the session. |
void |
removeAttribute(java.lang.String attribName)
Clears an attribute from the request context |
void |
removePersistentAttribute(java.lang.String attribName)
Clears an attribute from the session context |
void |
setAttribute(java.lang.String attribName,
java.lang.Object attribValue)
Sets an attribute that is valid for the duration of the request. |
void |
setClientAttribute(java.lang.String attribName,
java.lang.String attribValue)
If in HTTP environment, it sets an encrypted cookie to the client. |
void |
setPersistentAttribute(java.lang.String attribName,
java.lang.Object attribValue)
Saves an attribute to the actual session, rather than simply the response. |
| Method Detail |
setAttribute
public void setAttribute(java.lang.String attribName, java.lang.Object attribValue)
- Sets an attribute that is valid for the duration of the request.
getAttribute
public java.lang.Object getAttribute(java.lang.String attribName)
- Retrieves the object from the request context.
getAttributeNames
public java.util.Enumeration getAttributeNames()
- Retrieves all attribute names in the request context.
setClientAttribute
public void setClientAttribute(java.lang.String attribName, java.lang.String attribValue)
- If in HTTP environment, it sets an encrypted cookie to the client.
getClientAttribute
public java.lang.String getClientAttribute(java.lang.String attribName)
- Retrieves a value of a cookie set on the client's system. It also
decrypts the value with the password you set up in your
expresso-config.xmlfile.
getPeristentAttributeNames
public java.util.Enumeration getPeristentAttributeNames()
- Retrieves all attribute names from the session context.
setPersistentAttribute
public void setPersistentAttribute(java.lang.String attribName, java.lang.Object attribValue)
- Saves an attribute to the actual session, rather than simply the response.
Use this for storing objects between requests, but only use it with care
since the extra memory used may bog down systems under high load.
getPersistentAttribute
public java.lang.Object getPersistentAttribute(java.lang.String attribName)
- Retrieves the object from the session context.
invalidate
public void invalidate()
- Clear out the session. Invalidates the entire session.
removeAttribute
public void removeAttribute(java.lang.String attribName)
- Clears an attribute from the request context
removePersistentAttribute
public void removePersistentAttribute(java.lang.String attribName)
- Clears an attribute from the session context
|
|||||||||
| Home >> All >> com >> jcorporate >> expresso >> core >> controller >> [ session overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC