|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface HttpSession
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 | |
---|---|
java.lang.Object |
getAttribute(java.lang.String name)
XXX |
java.util.Enumeration |
getAttributeNames()
XXX |
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 |
removeAttribute(java.lang.String name)
XXX |
void |
removeValue(java.lang.String name)
Removes an item from the session. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
XXX |
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 |
---|
long getCreationTime() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the session has been invalidated.java.lang.String getId() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the session has been invalidated.long getLastAccessedTime() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the session has been invalidated.int getMaxInactiveInterval() throws java.lang.IllegalStateException
java.lang.IllegalStateException
java.lang.Object getValue(java.lang.String name) throws java.lang.IllegalStateException
name
- the name of the item required
java.lang.IllegalStateException
- if the session has been invalidated.java.lang.String[] getValueNames() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the session has been invalidated.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.
java.lang.IllegalStateException
- if the session has been invalidated.boolean isNew() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the session has been invalidated.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
java.lang.IllegalStateException
- if the session has been invalidated.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.
java.lang.IllegalStateException
- if the session has been invalidated.void setMaxInactiveInterval(int interval) throws java.lang.IllegalStateException
interval
- Probably seconds or -1 if never
java.lang.IllegalStateException
java.lang.Object getAttribute(java.lang.String name)
java.util.Enumeration getAttributeNames()
void setAttribute(java.lang.String name, java.lang.Object value)
void removeAttribute(java.lang.String name)
HttpSessionContext getSessionContext() throws java.lang.IllegalStateException
HttpSessionContext
has been depricated for
security reasons.
java.lang.IllegalStateException
- if the session has been invalidated.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |