|
|||||||||
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. |
int |
getMaxInactiveInterval()
Returns the minimum time this session will be kept alive by the server when it doesn't get accessed by a client. |
HttpSessionContext |
getSessionContext()
Deprecated. HttpSessionContext has been depricated for
security reasons. |
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. |
void |
setMaxInactiveInterval(int interval)
Sets the minimum time this session will be kept alive by the server when it doesn't get accessed by a client. Note: hmmm, should an interval of -1 mean that it should live forever? |
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 int getMaxInactiveInterval() throws java.lang.IllegalStateException
public java.lang.Object getValue(java.lang.String name) throws java.lang.IllegalStateException
name
- the name of the item requiredpublic 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 itempublic 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 void setMaxInactiveInterval(int interval) throws java.lang.IllegalStateException
interval
- Probably seconds or -1 if neverpublic HttpSessionContext getSessionContext() throws java.lang.IllegalStateException
HttpSessionContext
has been depricated for
security reasons.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |