Methods Summary |
---|
public java.lang.Object | getAttribute(java.lang.String name)Returns the object bound with the specified name in this session, or
null if no object is bound under the name.
|
public java.util.Enumeration | getAttributeNames()Returns an Enumeration of String objects
containing the names of all the objects bound to this session.
|
public long | getCreationTime()Returns the time when this session was created, measured
in milliseconds since midnight January 1, 1970 GMT.
|
public java.lang.String | getId()Returns a string containing the unique identifier assigned
to this session. The identifier is assigned
by the servlet container and is implementation dependent.
|
public long | getLastAccessedTime()Returns the last time the client sent a request associated with
this session, as the number of milliseconds since midnight
January 1, 1970 GMT, and marked by the time the container received the request.
Actions that your application takes, such as getting or setting
a value associated with the session, do not affect the access
time.
|
public int | getMaxInactiveInterval()Returns the maximum time interval, in seconds, that
the servlet container will keep this session open between
client accesses. After this interval, the servlet container
will invalidate the session. The maximum time interval can be set
with the setMaxInactiveInterval method.
A negative time indicates the session should never timeout.
|
public javax.servlet.ServletContext | getServletContext()Returns the ServletContext to which this session belongs.
|
public javax.servlet.http.HttpSessionContext | getSessionContext()
|
public java.lang.Object | getValue(java.lang.String name)
|
public java.lang.String[] | getValueNames()
|
public void | invalidate()Invalidates this session then unbinds any objects bound
to it.
|
public boolean | isNew()Returns true if the client does not yet know about the
session or if the client chooses not to join the session. For
example, if the server used only cookie-based sessions, and
the client had disabled the use of cookies, then a session would
be new on each request.
|
public void | putValue(java.lang.String name, java.lang.Object value)
|
public void | removeAttribute(java.lang.String name)Removes the object bound with the specified name from
this session. If the session does not have an object
bound with the specified name, this method does nothing.
After this method executes, and if the object
implements HttpSessionBindingListener ,
the container calls
HttpSessionBindingListener.valueUnbound . The container
then notifies any HttpSessionAttributeListener s in the web
application.
|
public void | removeValue(java.lang.String name)
|
public void | setAttribute(java.lang.String name, java.lang.Object value)Binds an object to this session, using the name specified.
If an object of the same name is already bound to the session,
the object is replaced.
After this method executes, and if the new object
implements HttpSessionBindingListener ,
the container calls
HttpSessionBindingListener.valueBound . The container then
notifies any HttpSessionAttributeListener s in the web
application.
If an object was already bound to this session of this name
that implements HttpSessionBindingListener , its
HttpSessionBindingListener.valueUnbound method is called.
If the value passed in is null, this has the same effect as calling
removeAttribute().
|
public void | setMaxInactiveInterval(int interval)Specifies the time, in seconds, between client requests before the
servlet container will invalidate this session. A negative time
indicates the session should never timeout.
|