public class Session extends Object
Modifier and Type | Method and Description |
---|---|
<T> T |
attribute(String name)
Returns the object bound with the specified name in this session, or null if no object is bound under the name.
|
void |
attribute(String name,
Object value)
Binds an object to this session, using the name specified.
|
Set<String> |
attributes()
Returns an
Enumeration of String objects
containing the names of all the objects bound to this session. |
long |
creationTime()
Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
|
String |
id()
Returns a string containing the unique identifier assigned to this session.
|
void |
invalidate()
Invalidates this session then unbinds any objects bound to it.
|
boolean |
isNew()
Returns true if the client does not yet know about the session or if the client chooses not to join the session.
|
long |
lastAccessedTime()
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.
|
int |
maxInactiveInterval()
Returns the maximum time interval, in seconds, that the container
will keep this session open between client accesses.
|
void |
maxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests the web container will invalidate this session.
|
javax.servlet.http.HttpSession |
raw()
Returns the raw
HttpSession object handed in by the servlet container. |
void |
removeAttribute(String name)
Removes the object bound with the specified name from this session.
|
public javax.servlet.http.HttpSession raw()
HttpSession
object handed in by the servlet container.public <T> T attribute(String name)
name
- a string specifying the name of the objectpublic void attribute(String name, Object value)
name
- the name to which the object is bound; cannot be nullvalue
- the object to be boundpublic Set<String> attributes()
Enumeration
of String
objects
containing the names of all the objects bound to this session.public long creationTime()
public String id()
public long lastAccessedTime()
public int maxInactiveInterval()
public void maxInactiveInterval(int interval)
interval
- public void invalidate()
public boolean isNew()
public void removeAttribute(String name)
name
- the name of the object to remove from this sessionCopyright © 2013. All Rights Reserved.