|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
A HttpSession holds session-dependant data on the server side. A servlet can request the servlet by using HttpServletRequest.getSession(...)
The handling of the Session objects is a job done by the server and servlets together.
| Method Summary | |
long |
getCreationTime()
Gets this session's creation time in seconds since january 1st 1970. |
java.lang.String |
getId()
Gets the unique session id. |
long |
getLastAccessedTime()
Gets the number of seconds since the previous access of this session. |
HttpSessionContext |
getSessionContext()
Gets this HttpSession's context. |
java.lang.Object |
getValue(java.lang.String name)
Gets a object from the set of name/value pairs in the session. |
java.lang.String[] |
getValueNames()
Get a list of all item names in the session. |
void |
invalidate()
Make this HttpSession unavailable for use by other servlets and tell the server to remove this session. |
boolean |
isNew()
Returns whether this session has been freshly created. |
void |
putValue(java.lang.String name,
java.lang.Object value)
Puts a name and value in the HttpSession. |
void |
removeValue(java.lang.String name)
Removes an item from the session. |
| Method Detail |
public long getCreationTime()
throws java.lang.IllegalStateException
public java.lang.String getId()
throws java.lang.IllegalStateException
public long getLastAccessedTime()
throws java.lang.IllegalStateException
public java.lang.Object getValue(java.lang.String name)
throws java.lang.IllegalStateException
name - the name of the item required
public java.lang.String[] getValueNames()
throws java.lang.IllegalStateException
public void invalidate()
throws java.lang.IllegalStateException
putValue() that implement
HttpSessionBindingListener will be called with
valueUnbound().
Also: make it throw an IllegalStateException when a
servlet tries to execute one of its methods.
public boolean isNew()
throws java.lang.IllegalStateException
public void putValue(java.lang.String name,
java.lang.Object value)
throws java.lang.IllegalStateException
HttpSessionBindindListener then
the valueBound() method of the Object will be called.name - the name of the itemvalue - the value of the item
public void removeValue(java.lang.String name)
throws java.lang.IllegalStateException
HttpSessionBindindListener then
the valueUnBound() method of the Object will be called.name - the name of the item.
public HttpSessionContext getSessionContext()
throws java.lang.IllegalStateException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||